Symbols & Methods Flashcards

To learn the basics of Ruby symbols and function, so that I may read code (41 cards)

1
Q

#

A

octothrope - used to make a comment

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

{$0}

A

From command line, the name of the script you are running

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

{variable}

A

used for interpolation of a variable / to include your variable that doesn’t have information in it yet

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

$

A

attaches a variable from the command line

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

%

A

Modulo that returns the remainder in division

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

%d

A

represents a digit in a text string

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

%s

A

represents a string of text in a test string

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

( )

A

used to encapsulate arguments

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

*

A

multiplication

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

+

A

addition

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

-

A

subtraction

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

/

A

division

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

<

A

less than

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

«TEXT TEXT

A

to start and end a chunk of code that will not be read by ruby

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

<=

A

less than or equal to

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

>

A

greater than

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

> =

A

greater than or equal to

18
Q

ARGV

A

argument value, holds arguments held on the cmd line

19
Q

File

A

used as a method to define and enact file options

20
Q

File.close()

A

closes a file

21
Q

File.exists?

A

check to see if a file exists or not

22
Q

File.open()

23
Q

File.open(filename, ‘w’)

A

Specifically opens a file for writing

24
Q

File.read()

A

reads the contents of a file

25
File.readline()
reads a numbered line on a file
26
File.seek()
locate a particular spot in the file
27
File.truncate()
remove the contents of a file
28
File.write()
write line or characters to a file
29
STDIN
used when ARGV is used to get input from the user
30
[ ]
array
31
\\
permits on backslash
32
\n
new line
33
\t
adds tab space
34
chomp
used w/gets to get info
35
do
reflects the start of a block of code to be run together
36
end
closes a block section of code
37
gets
takes input
38
open
open a file or url
39
print
takes text and prints it on the screen
40
puts
used to "put" a "string" of characters on the screen along with a new line
41
variable
a value stored