Data types: Numbers, Strings, Booleans
Math: Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Exponentiation (**)
Modulo (%) = returns the remainder of division. Ex: 25 % 7 = 4
7 goes into 25 three times with 4 being left over.
Puts and Print:
Print: takes whatever you give it and prints it to the screen
puts: (puts string) adds a new line after the thing you print. Lets you see the result of something or variable.
The '.length' method: methods are summoned using (.).
if you have a string and take the length, it counts the characters, numbers, letters, and spaces.
The '.reverse' Method: it spits out a backwards version of the string you gave it.
'.upcase' & '.downcase': .upcase and .downcase methods convert a string to ALL UPPER CASE or all lower case, respectively.
.capitalize: Capitalizes the first letter of a string.
Single-Line Comments: # is for comments in ruby
Multi-Line Comments: =begin, =end
Variable: declare it by setting it = to something
gets: gets input from user.
chomp: removes extra line
Top comments (0)