if syntax code example

Example 1: syntax of if stmt

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

Example 2: if statement

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

Example 3: javascript if else

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

Example 4: javascript if and statement

let a = 1;
let b = 2;
if(a == 1 && b ==2){
	// Code here 
}

Example 5: if statement

if( name = 'george washington'):
	print("You have the same name as the first president of the United States")
    // python 
else:
	print("You do not have the same name as George Washington")

Tags:

Html Example