catch (:done) do
5.times { |i|
5.times { |j|
puts "#{i} #{j}"
throw :done if i + j > 5
}
}
end
外部ループを抜けたいときはcatchとthrowを使えばよい
More than 5 years have passed since last update.
catch (:done) do
5.times { |i|
5.times { |j|
puts "#{i} #{j}"
throw :done if i + j > 5
}
}
end
外部ループを抜けたいときはcatchとthrowを使えばよい
Register as a new user and use Qiita more conveniently