Running Programs From A File
Goals
Step 1
Type this in the file my_program.rb:# This is a comment line. # Comment lines start with a pound sign, and the computer ignores them. # Since the computer ignores them you can use them for notes to yourself. puts 'This code is in a file!' some_variable = 19 puts "I stored a variable with the value #{some_variable}!"
Step 2
Step 3
TerminallsExpected result:my_program.rbTerminalmore my_program.rbExpected result:puts 'This code is in a file!' some_variable = 19 puts "I stored a variable with the value #{some_variable}!"
Step 4
Terminalruby my_program.rbExpected result:This code is in a file! I stored a variable with the value 19!
Explanation
Next Step:
Go on to Summary: Tools