Getting Started with App Development [Section 4: Operators] Flashcards

1
Q

Use the ______ operator to assign a value

A

=

e.g.,

let favoritePerson = “Luke”

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

The = operator is also used to _______ or reassign a value

A

modify

e.g.,

The following code declares a shoeSize variable and assigns 8 as its value. The value is then modified to 9:

var shoeSize = 8
shoeSize = 9 // Reassigns shoeSize to 9

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

When you use the ______ operator (/) on Int values, the result will be an Int value rounded down to the nearest whole number

A

division

e.g.,

The following code declares a shoeSize variable and assigns 8 as its value. The value is then modified to 9:

var shoeSize = 8
shoeSize = 9 // Reassigns shoeSize to 9

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

If you explicitly declare constants or variables as ________ values, the results will include decimal values

A

Double

e.g.,

let x: Double = 51
let y: Double = 4
let z = x / y // z has a value of 12.75

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

You can use a ________ ________ operator to modify a value that’s already been assigned

A

compound assignment

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

The compound assignment operator adds the ____ operator after an arithmetic operator

A

=

e.g.,

myScore += 3 // Adds 3 to myScore
myScore -= 5 // Subtracts 5 from myScore
myScore *= 2 // Multiples myScore by 2
myScore /= 2 // Divides myScore by 2

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

You can’t ______ and match number types when performing mathematical operations

A

mix

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