# Arduino - If statement

It takes an expression in parenthesis and a statement or block of statements. If the expression is true then the statement or block of statements gets executed otherwise these statements are skipped.

## Different forms of if statement

Form 1

```if (expression)
statement;
```

You can use the if statement without braces { } if you have one statement.

Form 2

```if (expression) {
Block of statements;
}
```

## if Statement – Execution Sequence ### Example

```/* Global variable definition */
int A = 5 ;
int B = 9 ;

Void setup () {

}

Void loop () {
/* check the boolean condition */
if (A > B) /* if condition is true then execute the following statement*/
A++;
/* check the boolean condition */
If ( ( A < B ) && ( B != 0 )) /* if condition is true then execute the following statement*/ {
A += B;
B--;
}
}
```
arduino_control_statements.htm
{"ft_lang_label":"__label__en","ft_lang_prob":0.5569312,"math_prob":0.8364713,"size":2560,"snap":"2022-40-2023-06","text_gpt3_token_len":583,"char_repetition_ratio":0.29616588,"word_repetition_ratio":0.038961038,"special_character_ratio":0.26054686,"punctuation_ratio":0.036809817,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97704345,"pos_list":[0,1,2],"im_url_duplicate_count":[null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-01T21:25:09Z\",\"WARC-Record-ID\":\"<urn:uuid:fbc25d29-9dcf-4cd2-9ddf-898f7852f73d>\",\"Content-Length\":\"34169\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6bf86162-d48d-413c-bd5a-619e1e549254>\",\"WARC-Concurrent-To\":\"<urn:uuid:211f947a-82ec-47f3-a30c-f7faabc6262d>\",\"WARC-IP-Address\":\"192.229.210.176\",\"WARC-Target-URI\":\"https://www.tutorialspoint.com/arduino/arduino_if_statement.htm\",\"WARC-Payload-Digest\":\"sha1:2ISF5E5DAKCHAKY2LVLWW7U4O7QBJ3JK\",\"WARC-Block-Digest\":\"sha1:CHJASLS7EFMUUPIL3SFD3QG6KUTZH6YR\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499953.47_warc_CC-MAIN-20230201211725-20230202001725-00136.warc.gz\"}"}