Operators Flashcards

1
Q

Operator

A

Symbol for built-in language calculations

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

Compound Operators

A

Provide a shorthand way to update a variable

+=, -=, *=, /=, %=

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

unary-

A

Negation of value

-1

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

%

A

Modulo

Remainder of the division of two integers

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

+=

A

Compound Operator

userAge += 1 IS userAge = userAge + 1

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

Arithmetic Operators

A

Perform arithmetic

unary-, *, /, %, +, -

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

Equality Operators

A

==, ! =

Cannot be used with floating-point numbers

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

Logical Operators

A

Evaluates to true or false (binary)

&&, ||, !

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

Relational Operators

A

Evaluates to true or false (binary)
Only one operator is evaluated at a time, based on precedence rules
< , > , <=, >=, ==, !=

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

Ternary Operator

A

Conditional expression with 3 operands
Good practice limits use to assignment statements
(condition) ? exprWhenTrue: exprWhenFalse

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

Short Circuit Evaluation

A

Logical operators stop left to right evaluation as soon as the result can be determined
AND / OR

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

++i

A

Increment Operator

Shorthand of i = i + 1

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

–i

A

Decrement Operator

Shortand of i = i - 1

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

[]

A

String position

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