puts函数在控制台上显示一个字符串。
清单1显示了一个简单的例子,它声明了一个包含6个属性的hash:一个字符串、一个整数、一个布尔值、一个未定义的属性、另一个hash和一个函数。
A simple example is shown in Listing 1, declaring a hash consisting of 6 attributes: a string, an integer, a Boolean, an undefined attribute, another hash, and a function.
下面就练习一下了,写一个函数,接收一个字符串做参数,然后倒序显示每一个字符,每行显示一个。
As an exercise, write a function that takes a string as an argument and displays the letters backward, one per line.
应用推荐