Skip to content

Instantly share code, notes, and snippets.

@adriculous
Created July 19, 2016 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriculous/2c634a2b81a9907d18d2284abe58b336 to your computer and use it in GitHub Desktop.
Save adriculous/2c634a2b81a9907d18d2284abe58b336 to your computer and use it in GitHub Desktop.
"Always Three" First Ruby Script (courtesy of Skillcrush)
# You are now at the Always 3 script. It's in Ruby, girl. Hello and welcome!
# Ask the person (user) to provide a number. Any number.
puts "Please, give me your number, I mean A number!"
# Hint: use 'gets' method, convert to an integer using 'to_i', make it a variable
i_number = gets.to_i
# add 5
ii_number = i_number + 5
# multiply by 2
ii_number = ii_number * 2
# subtract 4
ii_number = ii_number - 4
# divide by 2
ii_number = ii_number / 2
# subtract i_number from ii_number
fin_number = ii_number - i_number
# show fin_number back to person/user
puts "You know what it is! #{fin_number}, of course!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment