LoginSignup
4
1

More than 5 years have passed since last update.

Ruby while 無限ループ

Last updated at Posted at 2018-06-26

Rubyのwhile文を書いてる際に、気を付けてほしいこと!
(僕もやってしまった笑)

通常コード↓

i = 0
  while i < 3 do
  puts "無限ループ"
  i += 1
end

(!)↑ 「i += 1」が抜けてしまうと無限ループになり処理がずっと走ってしまうので、
注意すること。もし抜けてしまい、無限ループに陥った場合は「ctrl + c」で脱出しましょう。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1