Ruby characters Flashcards

You may prefer our related Brainscape-certified flashcards:
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)

A

?

24
Q

\b backspace (escape)

A

?

25
Q

\f - formfeed (escape)

A

?

26
Q

\n - linefeed (escape)

A

Creates a new line inside quotes

27
Q

\r - carriage return (escape)

A

?

28
Q

\t - horizontal tab

A

Creates a tab inside quotes

29
Q

\uxxxx - 16-bit hex value (escape)

A

?

30
Q

\v - vertical tab (escape)

A

Inserts a vertical tab inside quotes

31
Q

\ooo - octal value (escape)

A

?

32
Q

\xhh - hex value (escape)

A

?

33
Q

gets

A

Prompts input, and sets it to a variable name

34
Q

.chomp

A

removes any escapes

35
Q

.to_i

A

Used to turn something into an integer

36
Q

ARGV - argument variable

A

Assigns variables by whatever is opened in the terminal. It is assigned from left to right.

37
Q

prompt

A

Prompts users for input? Can set with ‘=’ what should be shown.

38
Q

open() - command

A

Will open whatever file is placed inside the parentheses

39
Q

.read (command)

A

Reads the contents of the file. You can assign the result to a variable.

40
Q

.close (command)

A

Command to close a file

41
Q

.readline (command)

A

Reads just one line of a text file

42
Q

.truncate (command)

A

Empties the file. Watch out if you care about the file.

43
Q

.write(‘stuff’) (command)

A

Writes “stuff” to the file.

44
Q

‘w’ -

A

Used with the open(file, ‘w’) in order to open the file to be written.

45
Q

‘r’

A

Used with the open(file, ‘r’) in order to open the file to be read.

46
Q

target.write(x)

A

x is whatever you’d like to write

47
Q

def

A

Starts a function

48
Q
function
function_name(arg1, arg2)
A

a small program that you set, and then can call back. Can set the arguments in many different ways.

49
Q

end

A

Closes a function

50
Q

seek(0)

A

Will set the writing cursor to the very beginning of a document.

51
Q

+=

A

a = a + b

52
Q

return

A

Sets a variable to a be a value from a function