-
Notifications
You must be signed in to change notification settings - Fork 24
Conditionals
Rohan Singh edited this page Aug 21, 2014
·
17 revisions
for (var i = 0; i <= 5; i++) {
if (i == 1) {
print('one');
} else if (i == 2) {
print('two');
} else if (i == 3) {
print('three');
} else if (i == 4 || i == 5) {
print('four or five');
} else {
print('something else');
}
}
for (var i = 0; i <= 5; i++) {
switch (i) {
case 1:
print('one');
case 2:
print('two');
case 3:
print('three');
case 4:
case 5:
print('four or five');
default:
print('something else');
}
}