Skip to content

Instantly share code, notes, and snippets.

@kajatiger
Created October 19, 2016 20:02
Show Gist options
  • Save kajatiger/3d7036b3247c967275a61cb95b7c36e6 to your computer and use it in GitHub Desktop.
Save kajatiger/3d7036b3247c967275a61cb95b7c36e6 to your computer and use it in GitHub Desktop.
conditional ruby blocks
if (5+5==10)
puts "this is true"
else
puts "this is false"
end
def choose
puts "do you like programming? yes or no or maybe please"
choice = gets.chomp
case choice.downcase
when "yes"
puts "that\'s great!"
when "no"
puts "that\'s too bad"
when "maybe"
puts "Glad you are giving it a chance!"
else
puts "that wasn\'t a yes or no or maybe"
end
end
choose
# 3.times do
# puts "hello!"
# end
# number = 0
# while (number <= 10) do
# p "the number is now #{number}"
# number += 1
# end
(0..10).each do |n|
p "the number is #{n}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment