day 3 Flashcards

1
Q

if else

A

if { // code to execute } else { // code to execute }

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

else if

A

if firstCondition { codeToExecuteIfTrue } else if secondCondition { codeToExecuteIfTrue } else if thirdCondition { codeToExecuteIfTrue } else { codeToExecuteIfEverythingElseIsFalse }

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

switch

A

switch month { case 1: print(“January”) case 2: print(“February”) // … }

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

range

A

1…10

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

for loops

A

for n in 1…5 { print(n) }

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

while loop

A

var index = 10 while index < 20 { print( “Value of index is (index)”) index = index + 1 }

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

break

A

var index = 10 repeat { index = index + 1 if( index == 15 ){ break } print( “Value of index is (index)”) } while index < 20

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

repeat-while example

A

var sum = 2 repeat{print(sum)sum = sum + 2} while sum < 10

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

repeat while flowchart

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