SWIFT CHAP 07 Flashcards

1
Q

Looping Control Flow?

A

sequenced of looped statements wich are to be excuted until specfied condition is met

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

name the two types of control flow?

A

Looping Control

Condtional FLOW Control

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

for-in statement used for?

A

to iterate over s sequence of items contained in a number range or collection

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

CONDITIONAL FLOW CONTROL

A

WHETHER OR NOT CODE GETS EXCUTED

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

REPEAT WHILE LOOP

A

Evaluate expression while repeating code in the loop body.

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

if the condition is false on the first try for of a repeat while loop what happens to code?

A

does not get executed

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

breaking a loop ( {break} ) mean?

A

breaking out of code before the expression is met.

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

what does the {break} statement do when it exits a loop?

A

proceeds to the next line of code.

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

what does the if statement evaluate?

A

boolean true or false values.

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

{continue} statement?

A

causes all remaining statements in a loop body 2 b skipped and returned to top of loop.

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

after the {contiune} statement is executed what happens to the loop execution?

A

execution gets returned to the top of the loop.

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

if.. else statement?

A

like the else-if statement except that specify more than two conditions.

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

else.. if?

A

allows you to specify two expressions with true or false.

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

if the boolean expression in an (if) statement evaluates to true or false what happens?

A

if TRUE then code is executed.

If false code is skipped.

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

while loop … statement?

A

repeats a set of task, whilst a condition is met?

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

why do we use a (while loop)?

A

When we don’t know the number of times a loop will be needed to while meeting a condition.

17
Q

when do we use (for…in) loops?

A

For when you know the number of loops needed.

18
Q

(For in) loops don’t require a (const) name what can you reference instead?

A

you can replace a const-name with an underscore (_)

example:

var count = 0

for _ in 1…5

{count += 1}

19
Q

decisions define what in code?

A

wich code gets executed, how man times it’s executed or if code gets bypassed while executing.

20
Q

if a continue statement is triggered execution will be skipped to up to the top an of while loop

what happens to the body loop?

A

it will get executed until the criteria is met

21
Q

a guard statement? {gaurd}

A

contains a boolean value that MUST BE TRUE in order to advance to the next line of code.

22
Q

what clause does the (guard) statement must include?

A

must include an (else) clause to be executed. incase expression is false.

23
Q

the (else) clause in a (guard) statement must include what?

A

a statement to exit the code flow

example: return, break, continue or throw statements