Conditional Statements

Variable is less than criteria

if(input < 20 ){
Statements to process
}

Variable is equal to criteria

if(input == 20 ){
Statements to process
}

Variable is less than or equal to criteria

if(input <= 20 ){
Statements to process
}

Variable is greater than or equal to criteria

if(input >= 20 ){
Statements to process
}

Variable is not equal to criteria

if(input != 20 ){
Statements to process
}

Both criteria must be met to be true

if(firstvar != 20 && secondvar == 2 ){
Statements to process
}

One or both criteria must be met to be true

if(firstvar != 20 || secondvar == 2 ){
Statements to process
}

Variable is not a number

if(isNaN(firstvar)) {
Statements to process
}

If then or else

if(input == 20 ){
Statements to process
}
else {
Statements to process
}

Value of the Variable is an empty string

if(input == ""){
Statements to process
}


Switch Conditional Statement

switch ( ExpressionToMatch) {
case "Maryland" :
Statements;
break;
case "Delaware ":
Statements;
break;
case "West Virginia ":
Statements;
break;
case "New York ":
break;
default :
Statements;
}

Home
Site Index