Fri 20 July 2018, in category Conditional
Conditionals typically feature relatively simple logic to determine whether or not to execute a certain section of code.
We'll take a look at a series of boolean statements and their expected valuation.
if (i < 10) {
System.out.println("i is Less than 10!");
}
else if (i >= 10 && i < 20){
System.out.println("i is between 10 and 20!")
}
else {
System.out.println("i is Greater Than or Equal to 20!");
}
if (i < 10) {
Console.WriteLine("i is Less than 10!");
}
else if (i >=10 && i < 20){
Console.WriteLine("is is between 10 and 20!")
}
else {
Console.WriteLine("i is Greater Than or Equal to 20!");
}
if i < 10:
print("i is Less than 10!")
elif i >= 10 and i < 20:
print("i is between 10 and 20!")
else:
print("i is Greater Than or Equal to 10!")
if (i < 10) {
console.log("i is Less than 10!")
}
else if (i >= 10 && i < 20){
console.log("i is between 10 and 20!")
}
else {
console.log("i is Greater Than or Equal to 10!")
}
if i < 10 {
fmt.Println("i is Less than 10!")
} else if i >= 10 && i < 20 {
fmt.Println("i is between 10 and 20!")
} else {
fmt.Println("i is Greater Than or Equal to 10!")
}