Codecademy Ruby 1 Flashcards
What’s a boolean?
A true or false statement
It’s also important to remember that Ruby is..
case-sensitive
never use _______ with booleans,
quotation marks (‘ or “) or Ruby will think you’re talking about a string (a word or phrase)
What’s the name of this kinda thing? 2**8
exponentiation
What’s an easier way to do 222
2**3
What’s the name of the operator that returns the remainder of division?
Modulo
What’s 25 % 7?
4
What’s the difference between print and puts?
puts adds inserts a blank line after the output
Everything in Ruby is an _______ with built in ____
object / method
Editor>______>console
interpreter
Display the number of characters in ‘Tom’
puts “tom”.length
method for reversing values
.reverse
method for changing case
.upcase and .downcase
what do you use for a multi-line comment?
=begin
comment
yes yes yes
=end
(no space between the = and begin. Maths is ok either way with that though)
what’s the convention for variables in Ruby?
lower case with _ between words, with no other symbols
what character do you use to set variables?
=
what’s do you call a positive or negative number with no decimal bit?
an integer
what operator do you use to call a string?
.
For example “string”.method
method to get inputs
gets