IF else statement
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
IF else statement
var age=20;
if (age < 18) {
console.log("underage");
} else {
console.log("let em in!");
}
if else statement
if ((age >= 14) && (age < 19)) { // logical condition
status = "Eligible."; // executed if condition is true
} else { // else block is optional
status = "Not eligible."; // executed if condition is false
}
Example of an IF..ELSE Statement
public class Test {
public static void main(String args[]) {
int x = 30;
if( x < 20 ) {
System.out.print("This is if statement");
}else {
System.out.print("This is else statement");
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us