Learn Ruby the Hard Way: Words & Symbols Flashcards
terminal:
irb
into ruby realm!
mkdir NAME
Make Directory
cd NAME
Change Directory
puts
write out string and create new line
ruby ex1.rb
run ex1.rb
Caret character, points out where the error is
#
Anything after this on the same line is a comment
+
plus which can add two things
-
minus which can subtract two things
/
slash which can divide two things
*
asterisk which can multiply two things
%
percent which does the modulo thing and string substitution; example
“We are a %s and %s.” % [animal1, animal2]
<
less than
>
greater than
<=
less-than-equal
> =
greater-than-equal
=
equal, set a variable
_
underscore
format string
“ANYTHINGINHERE”
string
something a human will read or be given
string interpolation
put a defined string within a string using “#{}”
\n
put a new line character into the string at that point.
<<WHATEVER text text WHATEVER
document syntax, which uses «NAME and works like a string, but you also can put as many lines of text you as want until you type NAME again.
\
These two characters will print just one back-slash.