Ex 37 Operators Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

+

A

Add

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

-

A

Subtract

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

*

A

Multiply

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

**

A

Power of

2 ** 4 == 16

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

/

A

Divide

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

%

A

Modulus

2 % 4 == 2

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

.

A

Dot access

“1”.to_i == 1

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

::

A

Colon access

Module::Class

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

[]

A

List brackets

[1,2,3,4]

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

!

A

Not

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

> =

A

Greater than equal

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

<=

A

Less than equal

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

<=>

A

Comparison

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

==

A

Equal

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

===

A

Equality

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

!=

A

Not equal

17
Q

&&

A

Logical and (higher precedence)

18
Q

||

A

Logical or (higher precedence)

19
Q

..

A

Range inclusive

(0..3).to_a == [0, 1, 2, 3]

20
Q

A

Range non-inclusive

(0…3).to_a == [0, 1, 2]

21
Q

@

A

Object scope

@var ; @@classvar

22
Q

@@

A

Class scope

@var; @@classvar

23
Q

$

A

Global scope

$stdin