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
| var stack = 1: | |
| while(stack <=5 ) { | |
| stack = stack * 2; | |
| print(stack); | |
| } |
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
| var stack = 1: | |
| while(stack <=5 ); { | |
| stack = stack * 2; | |
| print(stack); | |
| } |
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
| Macintosh:~ toreystriffolino$ /usr/local/bin/node | |
| > |
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
| first, second, third = ARGV | |
| puts "The script is called: #{0}" | |
| puts "Your first variable is: #{first}" | |
| puts "Your second variable is: #{second}" | |
| puts "Your third variable is: #{third}" |
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
| user = ARGV.first | |
| prompt = '> ' | |
| puts "Hi #{user}, I'm the #{$0} script." | |
| puts "I'd like to ask you a few questions." | |
| puts "Do you like me #{user}?" | |
| print prompt | |
| likes = STDIN.gets.chomp() | |
| puts "Where do you live #{user}?" |
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
| user = ARGV.first | |
| prompt = '> ' | |
| puts "Hi #{user}, I'm the #{$0} script." | |
| puts "I'd like to ask you a few questions." | |
| puts "Do you like me #{user}?" | |
| print prompt | |
| like = STDIN.gets.chomp() | |
| puts "Where do you live #{user}?" |
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
| user = ARGV.first | |
| prompt = '> ' | |
| puts "Hi #{user}, I'm the #{$0} script." | |
| puts "I'd like to ask you a few questions." | |
| puts "Do you like me #{user}?" | |
| print prompt | |
| likes = STDIN.gets.chomp() | |
| puts "Where do you live #{user}?" |
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
| user = ARGV.first | |
| prompt = 'Stuffy ' | |
| puts "Hi #{user}, I'm the #{$0} script." | |
| puts "I'd like to ask you a few questions." | |
| puts "Do you like me #{user}?" | |
| print prompt | |
| likes= STDIN.gets.chomp() | |
| puts "Where do you live #{user}?" |
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
| print "How old are you? " | |
| age = gets.chomp() | |
| print "How tall are you? " | |
| height = gets.chomp() | |
| print "How much do you weigh? " | |
| weight = gets.chomp() | |
| puts "So, you're #{age} years old, #{height} tall and #{weight} heavy." |
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
| Macintosh:rubysamplecode toreystriffolino$ ruby ex10.rb | |
| I'm tabbed in. | |
| I'm split | |
| on a line. | |
| I'm \ a \ cat. | |
| I'll do a list: | |
| * Cat food | |
| * Fishies | |
| * Catnip |