Keywords Flashcards
Keywords in Ruby and what they do
1
Q
BEGIN
A
Run this block when the script starts
2
Q
END
A
Run this block when the script is done
3
Q
alias
A
create another name for a function
4
Q
and
A
Logical and, but lower priority than &&
5
Q
begin
A
Start a block, usually for exceptions
6
Q
break
A
break out of a loop right now
7
Q
case
A
Case style conditional, like an if
8
Q
class
A
Define a new class
9
Q
def
A
define a new function
10
Q
defined?
A
Is this class/function/etc. defined already?
11
Q
do
A
Create a block that maybe takes a parameter
12
Q
else
A
Else conditional
13
Q
elsif
A
Else if conditional
14
Q
end
A
Ends blocks, functions, classes, everything
15
Q
ensure
A
Run this code whether an exception happens or not