源代码:
#!/usr/bin/ruby # -*- coding: UTF-8 -*- $i = 0 $num = 5 begin puts("在循环语句中 i = #$i" ) $i +=1 end while $i < $num
运行结果:
#!/usr/bin/ruby # -*- coding: UTF-8 -*- $i = 0 $num = 5 begin puts("在循环语句中 i = #$i" ) $i +=1 end while $i < $num