Real ruby Flashcards
alias
To create a second name for the variable or method.
and
A command that appends two or more objects together.
BEGIN
Designates code that must be run unconditionally at the beginning of the program before any other.
begin
Delimits a “begin” block of code, which can allow the use of while and until in modifier position with multi-line statements.
break
Gives an unconditional termination to a code block, and is usually placed with an argument.
case
starts a case statement; this block of code will output a result and end when it’s terms are fulfilled, which are defined with when or else.
class
Opens a class definition block, which can later be reopened and added to with variables and even functions.
def
Used to define a function.
defined?
A boolean logic function that asks whether or not a targeted expression refers to anything recognizable in Ruby; i.e. literal object, local variable that has been initialized, method name visible from the current scope, etc.
do
Paired with end, this can delimit a code block, much like curly braces; however, curly braces retain higher precedence.
else
Gives an “otherwise” within a function, if-statement, or for-loop, i.e. if cats = cute, puts “Yay!” else puts “Oh, a cat.”
elsif
Much like else, but has a higher precedence, and is usually paired with terms.
END
Designates, via code block, code to be executed just prior to program termination.
end
Marks the end of a while, until, begin, if, def, class, or other keyword-based, block-based construct.
ensure
Marks the final, optional clause of a begin/end block, generally in cases where the block also contains a rescue clause. The code in this term’s clause is guaranteed to be executed, whether control flows to a rescue block or not.
FALSE
denotes a special object, the sole instance of FalseClass. false and nil are the only objects that evaluate to Boolean falsehood in Ruby (informally, that cause an if condition to fail.)
for
A loop constructor; used in for-loops.
if
Ruby’s basic conditional statement constructor.
in
Used with for, helps define a for-loop.
module
Opens a library, or module, within a Ruby Stream.
next
Bumps an iterator, or a while or until block, to the next iteration, unconditionally and without executing whatever may remain of the block.
nil
A special “non-object”; it is, in fact, an object (the sole instance of NilClass), but connotes absence and indeterminacy. nil and false are the only two objects in Ruby that have Boolean falsehood (informally, that cause an if condition to fail).
not
Boolean negation. i.e. not true # false, not 10 # false, not false # true.
or
Boolean or. Differs from || in that or has lower precedence.