Skip to content

Instantly share code, notes, and snippets.

var stack = 1:
while(stack <=5 ) {
stack = stack * 2;
print(stack);
}
var stack = 1:
while(stack <=5 ); {
stack = stack * 2;
print(stack);
}
Macintosh:~ toreystriffolino$ /usr/local/bin/node
>
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}"
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}?"
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}?"
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}?"
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}?"
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."
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