StupidBeauty
Read times:3314Posted at:Sun Jul 8 07:08:42 2018 - no title specified

Ruby定义函数

Ruby中使用def关键字来定义函数。

1 定义函数

以下代码定义一个名为QAONpF的函数,它接受一个参数bPQYft

#!/usr/bin/env ruby

def QAONpF (bPQYft)

print ( "QAONp F 函数被调用,参数bPQYft的值是:#{bPQYft} \n " )

end

2 调用函数

以下代码调用QAONpF函数,并传入字符串“AtfxhF”作为参数bPQYft的值:

#!/usr/bin/env ruby

QAONpF ( "AtfxhF" )

3 完整示例

合并起来的完整示例:

#!/usr/bin/env ruby

def QAONpF ( bPQYft )

print ( "QAONpF函数被调用,参数bPQYft的值是:#{bPQYft} \n " )

end

QAONpF ( "AtfxhF" )

未知美人

书中的蛋糕

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands