Answer:
A conditional statement instructs a system to do action based on whether a condition is true or false. This is frequently expressed as an if-then or if-then-else expression. A conditional statement is applied to predicate choices on circumstances. When there is no condition around the instructions, they run sequentially. If you add a condition to a block of statements, the execution flow may alter depend on the outcome of the condition. It is also known as a one-way selection statement because we utilize the if condition, provide the argument, and if the argument is passed, the relevant function is performed; else, nothing happens.
Examples of conditional statements:
1)<em> int time = 20;</em>
<em>if (time < 16) {</em>
<em> System.out.println("Have a good day.");</em>
<em>} else {</em>
<em> System.out.println(" Enjoy your evening.");</em>
<em>}</em>
<em />
2) <em>using namespace Conditional;</em>
<em>static void Main(string[] args) </em>
<em>{</em>
<em> // This method determines what a user should do for the day based on the weather condition </em>
<em />
<em> public void Weather(string myWeather)</em>
<em> {</em>
<em> // 1st condition</em>
<em> if (myWeather == "Sun")</em>
<em> {</em>
<em> // Decision</em>
<em> Console.WriteLine("Go to the beach");</em>
<em> }</em>
<em> // 2nd condition</em>
<em> else if (myWeather == "Rain")</em>
<em> {</em>
<em> Console.WriteLine("Go to the library")</em>
<em> }</em>
<em> // 3rd condition</em>
<em> else if (myWeather == "Cloudy")</em>
<em> {</em>
<em> Console.WriteLine("Go to the park")</em>
<em> }</em>
<em> else</em>
<em> {</em>
<em> //otherwise</em>
<em> Console.WriteLine("Rest at home")</em>
<em> }</em>
<em> }</em>
<em>}</em>