Created
October 8, 2019 21:37
-
-
Save arthur-littm/aee779fa2974aca8db5c5ac40a40c484 to your computer and use it in GitHub Desktop.
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
# 1. pick a price between 1 and 10 | |
number = rand(1..10) | |
# number = array.sample | |
puts number | |
guess = 0 | |
# LOOP HERE (stop if its correct guess) | |
until guess == number | |
# ask the user for his guess | |
puts "Pick a number from 1 to 10" | |
guess = gets.chomp.to_i | |
# if guess is above | |
if guess > number | |
# say too high | |
puts "Too high" | |
# else | |
elsif guess < number | |
# say too low | |
puts "Too low" | |
end | |
end | |
# END LOOP | |
puts "You won" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment