if statement syntax code example

Example 1: if statement

if( ID = josh ):
	print("ID confirmed")
    // python
else:
	print("ID does not exist")

Example 2: syntax of if stmt

if (condition)
{
     //Block of C statements here
     //These statements will only execute if the condition is true
}

Example 3: IF else statement

var age=20;
if (age < 18) {
	console.log("underage");
} else {
	console.log("let em in!");
}

Example 4: IF else statement

var age=20;
if (age < 18) {
	console.log("underage");
} else {
	console.log("let em in!");
}

Example 5: else if javascript

if (condition1) {
  // code to be executed if condition1 is true
} else if (condition2) {
  // code to be executed if the condition1 is false and condition2 is true
} else {
  // code to be executed if the condition1 is false and condition2 is false
}

Example 6: IF STATEMENT WHAT IS IT

if (X < 10) {
 print "Hello John";
}

Tags:

Java Example