If

Tue 10 July 2018, in category Conditional

conditional, if

An if condition allows you to check for a given condition if its true, then that statement is executed.
In the examples below, we're checking an integer variable i to see if it's less than 10.

Java

if(i < 10) {
    System.out.println("i is Less than 10!");
}

C#

if (i < 10) {
    Console.WriteLine("i is Less than 10!");
}

Python

if i < 10:
    print("i is Less than 10!")

JavaScript

if (i < 10) {
    console.log("i is Less than 10!")
}

Go

if i < 10 {
    fmt.Println("i is Less than 10!")
}