conditional statements Flashcards
1
Q
if can only execute if
A
condition is true
2
Q
if example
A
if true{
print(“hi”)
}
3
Q
if password example
A
var password="hi" if password=="hi"{ print("hello") }
4
Q
we use {} for
A
to mark beginning of line depending on condition
5
Q
else
A
executes if condition is false
6
Q
else example
A
var password="hi" if password=="mary"{ print("hello") }else{ print("pop") }
7
Q
else if
A
to add extra conditions
8
Q
else if example
A
var month="jan" if month=="j"{ print("0i") }else if month=="jan"{ print("kl") }
9
Q
what needs to be last statement
A
else