unity if and code example

Example 1: Unity if or

The symbol for OR is '||'

if( someRandomVariable == true || somethingElse == true || insaneRageMode == true )
   // do stuff

Example 2: if and unity

The and symbole is &&

Example 3: if unity

if () { // Put a condition in ().
	// If the condition is true then whatever is in here will happen.
} else if () { // Put a different condition in ().
	// If the if else condition is true then whatever is in here will happen.
} else { // If it doesn't equal any of the conditions.
	// If both conditions are false then this will happen.
}

Example 4: and unity

// The AND Symbol in Unity is &&

// if a is greater than b AND b is greater than c than
if(a > b && b > c)
{
// Do something
}

Example 5: or symbol in unity

// The Or Symbol Is   ||

Tags:

Misc Example