代码编辑器:
x
1
# !/usr/bin/ruby -w
2
# -*- encoding:utf-8 -*-
3
# filename: main.rb
4
# author: 简单教程(www.twle.cn)
5
# Copyright © 2015-2065 www.twle.cn. All rights reserved.
6
7
cnt = 0
8
for i in 0..3
9
puts "局部变量的值为 #{i}"
10
11
if i < 3 and cnt < 2 then
12
cnt += 1
13
redo
14
end
15
end
16
17
puts "cnt = #{cnt}"