Skip to content

Instantly share code, notes, and snippets.

@janetferguson
Created April 13, 2015 20:10
Show Gist options
  • Save janetferguson/868fa2db209fb7b67346 to your computer and use it in GitHub Desktop.
Save janetferguson/868fa2db209fb7b67346 to your computer and use it in GitHub Desktop.
Exercise 22
# False if/else statement
if 5 + 4 == 8
puts "this is true"
else
puts "this is false"
end
# True if/else statement
if 2 * 2 >= 3
puts "this is true"
else
puts "this is false"
end
def choose
puts "Do you like programming? Yes or no please."
choice = gets.chomp
if (choice.downcase == "yes")
puts "That\'s great!"
elsif (choice.downcase == "no")
puts "That\'s too bad!"
else
puts "That wasn\'t a yes or no."
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 new number is #{n}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment