Symbol review Flashcards
(80 cards)
1
Q
\
A
Escape backslash
2
Q
'
A
Escape single-quote (‘)
3
Q
"
A
Escape double-quote (“)
4
Q
\a
A
Escape bell
5
Q
\b
A
Escape backspace
6
Q
\f
A
Escape formfeed
7
Q
\n
A
Escape newline
8
Q
\r
A
Escape carriage
9
Q
\t
A
Escape Tab (TAB)
10
Q
\v
A
Escape vertical tab
11
Q
BEGIN
A
Run this block when the script starts.
12
Q
END
A
Run this block when the script is done.
13
Q
alias
A
Create another name for a function.
14
Q
and
A
Logical and, but lower priority than &&.
15
Q
begin
A
Start a block, usually for exceptions.
16
Q
break
A
Break out of a loop.
17
Q
case
A
Case style conditional, like an if.
18
Q
class
A
Define a new class.
19
Q
def
A
Define a new function.
20
Q
defined?
A
Is this class/function/etc. defined already?
21
Q
do
A
Create a block that maybe takes a parameter.
22
Q
else
A
Else conditional.
23
Q
elsif
A
Else if conditional
24
Q
end
A
Ends blocks, functions, classes, etc.
25
ensure
Run this code whether an exception happens or not.
26
for
For loop syntax. *The .each syntax is preferred.
27
if
If conditional.
28
in
In part of for-loops.
29
module
Define a new module.
30
next
Skip to the next element of a .each iterator.
31
not
Logical not. *use ! instead.
32
or
Logical or.
33
redo
Rerun a code block exactly the same.
34
rescue
Run this code if an exception happens.
35
retry
In a rescue clause, says to try the block again.
36
return
Returns a value from a function. *Mostly optional.
37
self
The current object, class, or module.
38
super
The parent class of this class.
39
then
Can be used with if optionally.
40
undef
Remove a function definition from a class.
41
unless
Inverse of if.
42
until
Inverse of while, execute block as long as false.
43
when
Part of case conditionals.
44
while
While loop.
45
yield
Pause and transfer control to the code block.
46
true
True boolean value.
47
false
False boolean value.
48
nil
Represents "nothing" or "no value".
49
strings
Stores textual information.
50
numbers
Stores integers.
51
floats
Stores decimals.
52
arrays
Stores a list of things.
53
hashes
Stores a key=value mapping of things.
54
+
Add
55
-
Subtract
56
*
Multiply
57
**
Power of
58
/
Divide
59
%
Modulus
60
>
Greater then
61
.
Dot access
62
::
colon access
63
[ ]
List brackets
64
!
Not
65
<
Less then
66
>=
Greater then equal
67
<=
Less then equal
68
==
Comparison
69
===
Equality
70
!=
Not equal
71
&&
Logical and (higher precedence)
72
||
Logical or (higher precedence)
73
..
Range inclusive
74
...
Range non-inclusive
75
@
Object scope
76
@@
Class scope
77
$
Global scope
78
What does a||b do?
Check if a is either false or nill, if it is return b. Otherwise return a
79
What will this return if count is nill?
| count ||= 37
count = 37
80
What will this return if count is 21?
| count ||= 37
count = 21