if x > 10: x += 10 elif x < 0: x -= 10 else x = 0 #switch-case構造はない while i < 100: i += 1 for num in [1,2,3]: print(num) if x > 10 x += 10 elsif x < 0 x -= 10 else x = 0 end case n when 0 puts "no hits" when 1 puts "one hit" else puts "#{n} hits" end while i < 100 do i += 1 end for num in 1..3 do puts num end #ふつう以下のように書く (1..3).each do |num| puts num end
![PythonとRubyの構文・文法などの比較チートシート - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/cbc1f0f7d57c0fbd7dc87d81bc07542c36a83eff/height=288;version=1;width=512/https%3A%2F%2Fcdn.qiita.com%2Fassets%2Fqiita-fb-2887e7b4aad86fd8c25cea84846f2236.png)