Exercise 22 Flashcards

(48 cards)

1
Q

puts

A

put string

Prints a string onto the screen. Includes newline character at the end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

print

A

Prints a string onto the screen.

Doesn’t include newline character at the end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

””

A

double quotes.

Tell Ruby to interpret what’s within the characters as Ruby code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

#

A

octothorpe or pound symbol. Turns lines of code into comments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

{}

A

format activator. Tells Ruby to interpolate its contents as code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

variable

A

A name that holds a piece of information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

+

A

plus operator. Used for addition. Can add numbers or combine strings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

-

A

minus operator. Used for subtraction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

/

A

slash operator. Used for division.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

*

A

asterik operator.

Used for multiplication. Can multiply numbers or strings. Two asteriks together will find a number’s exponent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

%

A

percent.

Can be used as a modulus operator. It finds the remainder after division.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

*>

A

less than.

Comparison operator. Checks to see if an item is less than another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

>

A

greater than. Comparison operator. Checks to see if an item is greater than another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

<=

A

less than or equal to. Comparison operator. Checks if an item is less than another. Also checksif the item is equal to the other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

=>

A

greater than or equal to. Comparison operator. Checks if an item is greater than another.Also checks if the item is equal to the other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

=

A

assignment operator.

Assigns values to a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

.

A

decimal.

Turns numbers into floats. Also used to call methods on variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

A

single quotes.

Create strings. Won’t do string interpolation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

true

A

boolean value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

false

A

boolean value.

21
Q

%q{}

A

Creates a string.

Doesn’t interpolate variable names or other Ruby code.

22
Q

’’’

A

triple single quotes.

Used for multi-line strings. Doesn’t interpolate variable names or other Ruby code.

23
Q

gets

A

get string.

Records string input from the user.

24
Q

.chomp

A

A method.

Removes newline character at the end of a string.

25
open(filename) 
A method.  Takes filename as parameter and returns file object.
26
\n  
newline.   Whitespace character, aka an Escape Sequence.  Separates paragraphs from each other.
27
\t 
tab.  Whitespace character, aka an Escape Sequence.  Indents.
28
\\ 
backward slash.  Escape sequence.  Tells Ruby to print a single backslash inside a string.
29
() 
Parentheses.  Can be used to enter parameters.
30
.to_i 
A method.  Converts string to an integer.
31
.to_f 
A method.  Converts fixnum to a float.
32
ARGV  
Argument variable.  Tells Ruby to take variables, unpack them, and assign values given by the user to the variable names assigned to ARGV.
33
$stdin 
standard input.  Used instead of gets when we enter arguments into the command line.
34
"""  
triple double quotes. Used for multi-line strings.  Interpolates code.
35
read
A method.  Used on file objects.  Returns a file's contents.
36
.close 
A method.  Used on file objects.  Closes file.
37
ARGV.first 
Used when entering only one argument into the command line.
38
.truncate() 
A method.  When used on file objects, it truncates existing contents to zero length.
39
.length  
A string method that returns the length of the string.
40
.exist?  
Returns true if a file exists.  Returns false if it doesn't.
41
w  
"Write-Only" mode.  Passed as an extra parameter to open(filename).  Automatically truncates existing file to zero length, or creates a new file for writing.
42
.write 
File object method.  Writes a given string into a file.
43
def  
Keyword used to denote a method's definition.
44
end  
Keyword that denotes the end of a method's definition.
45
*args  
Creates a list of arguments, used for multiple arguments.
46
.seek 
Looks for a specific place in the file's contents.
47
+=  
Positive increment.  Adds to existing variable value.  (variable +=  1 is the same as variable = variable + 1 )
48
return  
Gets data or variables back from the method.  We can use puts before calling a method, and it will actually print out the return value in our script.