七周七语言 Ruby 第一次作业

 1 puts "hello world"
 2 
 3 "Hello, Ruby.".index("Ruby.")
 4 
 5 x = 0
 6 puts "bigwhite" while (x = x + 1) < 11
 7 
 8 x = 0
 9 puts "This is sentence #{x = x + 1}" while x < 10
10 
11 x = gets().to_i
12 r = rand(100)
13 puts "value is #{r} greater" if x > r
14 puts "value is #{r} less" if x < r
15 puts "vaue is #{r} bingo" if x == r

 

posted @ 2015-03-14 23:14  bigwhite  阅读(143)  评论(0)    收藏  举报