# !/usr/bin/ruby -w # -*- encoding:utf-8 -*- # filename: main.rb # author: 简单教程(www.twle.cn) # Copyright © 2015-2065 www.twle.cn. All rights reserved. cnt = 0 for i in 0..3 puts "局部变量的值为 #{i}" if i < 3 and cnt < 2 then cnt += 1 redo end end puts "cnt = #{cnt}"