Tutorial - flow control Flashcards

1
Q

If statement syntax

A
if test:
  //code
elif test:
  //code
else:
 // code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Case statement syntax

A
case value
of value:
  code
of value:
  code
of value, value:
  code
else:
  code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is discard statement

A

Is a do nothing statement.
The reason is that you have to cover every value that a case statement may contain. But it is not pratical.
The compiler knows that a case statement with an else part cannot fail and thus the error disappears.

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

why string cases always need an else branch

A

because it is impossible to cover all possible string values

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

While statement syntax

A

while test:

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

For statement syntax (1 to 10 iteration)

A

for i in 1..10:

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

For statement syntax (1 until less than 10 iteration)

A

for i in 0..<10:

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

For statement syntax (string lenght)

A

for i in 0..

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