This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hp = 10 | |
damage = 5 | |
hp -= damage | |
if hp <= 0 | |
puts "勇者は死んだ" | |
elsif | |
puts "勇者のHPは#{hp}だ" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails new bootstrap-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "おみくじを引きますか?" | |
puts "コマンドを入力してください" | |
puts "yes → y" | |
puts "no → n" | |
print "コマンドを入力:" | |
command = gets.chomp | |
puts "あなたの入力したコマンドは「#{command}」です" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts("月を数値で入力してください。") | |
month = gets.to_i | |
case month | |
when 1,2,12 | |
puts("#{month}月は冬ですね。") | |
when 3,4,5 | |
puts("#{month}月は春ですね。") | |
when 6,7,8 | |
puts("#{month}月は夏ですね。") | |
when 9,10,11 |