Course Content
C# Basics
C# Basics
if statement
An if-statement, also known as Conditional Statement, is a method of executing a block of code based on a condition. The syntax of an if-statement is the following:
It takes an expression and executes the code block if the expression is true
.
For-example:
main.cs
In case the condition is false
the code block is ignored:
main.cs
Everything was clear?
Section 3. Chapter 5
Course Content
C# Basics
C# Basics
if statement
An if-statement, also known as Conditional Statement, is a method of executing a block of code based on a condition. The syntax of an if-statement is the following:
It takes an expression and executes the code block if the expression is true
.
For-example:
main.cs
In case the condition is false
the code block is ignored:
main.cs
Everything was clear?
Section 3. Chapter 5