# C# - if Statement

An if statement consists of a boolean expression followed by one or more statements.

## Syntax

The syntax of an if statement in C# is −

```if(boolean_expression) {
/* statement(s) will execute if the boolean expression is true */
}
```

If the boolean expression evaluates to true, then the block of code inside the if statement is executed. If boolean expression evaluates to false, then the first set of code after the end of the if statement(after the closing curly brace) is executed.

## Flow Diagram ## Example

```using System;

namespace DecisionMaking {
class Program {
static void Main(string[] args) {
/* local variable definition */
int a = 10;

/* check the boolean condition using if statement */
if (a < 20) {
/* if condition is true then print the following */
Console.WriteLine("a is less than 20");
}
Console.WriteLine("value of a is : {0}", a);
```a is less than 20;
{"ft_lang_label":"__label__en","ft_lang_prob":0.6611351,"math_prob":0.91568464,"size":956,"snap":"2020-34-2020-40","text_gpt3_token_len":211,"char_repetition_ratio":0.15126051,"word_repetition_ratio":0.0,"special_character_ratio":0.26464435,"punctuation_ratio":0.10465116,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97576845,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-23T23:44:52Z\",\"WARC-Record-ID\":\"<urn:uuid:ad32ee7a-142d-4fe1-80ba-d889834259f9>\",\"Content-Length\":\"26533\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:000d9306-0c7d-467b-b439-e0e0542500ca>\",\"WARC-Concurrent-To\":\"<urn:uuid:79c51032-2205-447f-84cb-d6e419b0264d>\",\"WARC-IP-Address\":\"72.21.91.42\",\"WARC-Target-URI\":\"http://www.tutorialspoint.com/csharp/if_statement_in_csharp.htm\",\"WARC-Payload-Digest\":\"sha1:2AN6LDJBN6AT4YFNLUPRQJFA7WIY2N2N\",\"WARC-Block-Digest\":\"sha1:IGLLUIFO2SPYJGUTGUP2MPDSIXRAH6U2\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400212959.12_warc_CC-MAIN-20200923211300-20200924001300-00785.warc.gz\"}"}