Ruby characters Flashcards

(52 cards)

1
Q

puts

A

Shows whatever comes next and inserts a line break

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

” “ - double quotes

A

Defines what will be written to the screen.

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

Leaves comments that will not be read by the code.

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

+ - plus

A

Addition between numbers

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

Subtract between numbers

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

/ - slash

A

Division between numbers

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

Multiplication between numbers

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

% - moduls

A

Grabs the remainder after a division

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

Determines if number on left is less than on the right

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

>

  • great than
A

Determines if number on left is greater than on the right

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

Determines if number on left is less than OR eaqual to number on the right

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

> = - greater than equal

A

Determines if number on left is greater than OR eaqual to number on the right

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

x = - variable

A

Sets the string on the left to whatever is on the right. Can use these in functions or in quotes.

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

_ - underscore

A

Used to add a space when that is not allowed, ex. in variable names, or functions

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

{x} - ?

A

Used with double quotes to use variables previously stated

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

print

A

Command to write variables and text to the screen WITHOUT adding a new line at the end

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

formatter

A

I have no idea

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

\n - backslash n (escape)

A

New line character

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

””” - triple quotes

A

Put at the beginning and end to write a bunch of text over several lines.

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

\ - backslash (escape)

A

Allows the backslash to be read as a stand alone character instead of an escape

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

' - Single Quote (escape)

A

Allows the single quote to be read as a stand alone character instead of an escape

22
Q

" - Double quote (escape)

A

Allows the double quote to be read as a stand alone character instead of an escape

23
Q

\a - bell (escape)

24
Q

\b backspace (escape)

25
\f - formfeed (escape)
?
26
\n - linefeed (escape)
Creates a new line inside quotes
27
\r - carriage return (escape)
?
28
\t - horizontal tab
Creates a tab inside quotes
29
\uxxxx - 16-bit hex value (escape)
?
30
\v - vertical tab (escape)
Inserts a vertical tab inside quotes
31
\ooo - octal value (escape)
?
32
\xhh - hex value (escape)
?
33
gets
Prompts input, and sets it to a variable name
34
.chomp
removes any escapes
35
.to_i
Used to turn something into an integer
36
ARGV - argument variable
Assigns variables by whatever is opened in the terminal. It is assigned from left to right.
37
prompt
Prompts users for input? Can set with '=' what should be shown.
38
open() - command
Will open whatever file is placed inside the parentheses
39
.read (command)
Reads the contents of the file. You can assign the result to a variable.
40
.close (command)
Command to close a file
41
.readline (command)
Reads just one line of a text file
42
.truncate (command)
Empties the file. Watch out if you care about the file.
43
.write('stuff') (command)
Writes "stuff" to the file.
44
'w' -
Used with the open(file, 'w') in order to open the file to be written.
45
'r'
Used with the open(file, 'r') in order to open the file to be read.
46
target.write(x)
x is whatever you'd like to write
47
def
Starts a function
48
``` function function_name(arg1, arg2) ```
a small program that you set, and then can call back. Can set the arguments in many different ways.
49
end
Closes a function
50
seek(0)
Will set the writing cursor to the very beginning of a document.
51
+=
a = a + b
52
return
Sets a variable to a be a value from a function