conditional statements Flashcards

1
Q

if can only execute if

A

condition is true

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

if example

A

if true{
print(“hi”)
}

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

if password example

A
var password="hi"
if password=="hi"{
  print("hello")
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

we use {} for

A

to mark beginning of line depending on condition

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

else

A

executes if condition is false

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

else example

A
var password="hi"
if password=="mary"{
  print("hello")
}else{
  print("pop")
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

else if

A

to add extra conditions

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

else if example

A
var month="jan"
if month=="j"{
  print("0i")
}else if month=="jan"{
  print("kl")
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what needs to be last statement

A

else

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