ELLIOT'S RUBY NOTES

for future reference by me for me


puts

like print() or 'p'. displays a message given.

puts "scott scott"

can also print variables like in javascript

puts 7 + 1

can also do subtraction(-), multiplication(*), division(/), and remainders of division(%).

can also combine strings just like is javascript.

puts "gabe" + "elliot"


comments

// or '!--' type command. just puts a comment

# what the patrick


variables

holds a value yada yada

variableName = value OR "value here!"

elliotAge = 16


a variable can only be used after it's defined. flow of execution goes from top to bottom.

teaType = green

puts teaType

teaType = english

puts teaType

the above code would output "green", followed by "english".


shorthand

x = x + 5 --> x += 5

x = x - 5 --> x -= 5

x = x * 5 --> x *= 5

x = x / 5 --> x /= 5

x = x % 5 --> x %= 5