all Flashcards
(161 cards)
what is the ruby equivalent of console.log
puts
how do you comment out in Ruby
#
do you run Ruby in the browser
no
how do you run ruby application
ruby filename.rb
what is the difference between puts and print
puts adds a line break and print does not
to log an array what do you use
P
P[1,2,3]
what do you use to log complex data like nested arrays and hashes
PP “pretty printing’
abbreviation for “Interactive Ruby”
irb
what does irb do
runs Ruby REPL in the terminal similar to browser console
what does REPL stand for
READ
EVALUATE
Print
Loop
what does irb return
2 lines
output of code
return value
what do you input in irb
code you want the output and return value for
not all methods have a return value
false
nil means
no value (like null)
what is snake case
how you write in Ruby using a _ between words instead of camel case
how do you exit irb
ctrl + d
what are the 3 parts of an error message
- location of error (where)
- description (why)
- type of error (who)
4 common types of errors
- name errors
- syntax error
- type error
- division error
8 common data types in Ruby
strings
methods
numbers
nil
boolean
symbols
arrays
hashes
what are strings
words
how to interpolation in Ruby
double quotes “ “
what are methods
like functions that get called on an instance or class
what is an instance
one unique object
What do you put at the beginning of instance methods
#