Created
January 6, 2015 22:19
-
-
Save troyleach/2111f5fc962f30f200ca to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # screencast #2 b = 1 - bc var a and bar or diff objects with diff objects_id's | |
| # screencast #2 x = 2 bc 1 plus 1 equals 2 (the value of x was changed by adding 1 to it) | |
| # below you will find chapter 5 | |
| # => ask the user for a their frist name | |
| # => ask the user for their middle name | |
| # => ask the user for their last name | |
| # => output, nice to meet you 'their name' | |
| # => ask the user for their favorit number | |
| # => add 1 to that number | |
| # => output ask the user isn't a bigger number better? | |
| puts "Hello, welcome to a simple program that I have written" | |
| print "What is your first name? " | |
| first_name = gets.chomp.capitalize | |
| print "What is your middle name? " | |
| middle_name = gets.chomp.capitalize | |
| print "What is your last name? " | |
| last_name = gets.chomp.capitalize | |
| print "last.. what is your favorite number? " | |
| fav_number = gets.chomp | |
| puts "=" * 85 | |
| puts "Hello #{first_name} #{middle_name} #{last_name}, nice to meet you. You told me your favorite number was #{fav_number}!" | |
| puts "But wouldn't #{fav_number.to_i + 1} be a better choice? it's bigger and better.." | |
| puts "=" * 85 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Screencast #2 exercise #1 - you totally nailed it, wow!
Screencast #2 exercise #2 - excellent! The way I like to explain it is that whenever you set a variable, Ruby first figures out everything to the right of the equals sign, and once it computes that, it sets all that to whatever is on the left of the equals sign.
Chapter #5 - very well done!