摘要:
1.ruby定义函数与执行函数案例def fact(n) if n == 0 1 else n * fact(n-1) end endprint fact(4)结果: 242.一个小例子words = ['a','b','c'] secret = words[rand(3)] print "guess?\n" while guess = STDIN.gets guess.chop! if guess==secret print "You win!\n" break else print "Sorr 阅读全文