Flow Statement in C#

Control Flow Statement – By Sagar Jaybhay

Control Flow: –  Control flow means in which order particular statement , method calls are executed during program execution.

Conditional Statement: – if and switch statement

  • If the statement took a Boolean value or Boolean expression as an input process on that and produce a result. Means if the statement took true or false as value. When you write multiple if statement and these statement are mutually exclusive then you can use if else instead of multiple if. Why we use if else because program execution much faster only one condition check happens and rest are skipped.

What is differencebetween && – & and || -|?

When we use && it checks the first condition if it is false it’s not checked second condition similar to this if we use || then if the first condition found to be true it will skip next. But when you use & or | then whatever the result of that first condition it will check next condition always.

  1. Switch Statement:– If our program contains multipleswitch statement then it can be replaced or we can use a switch statement instead of these multiple ifstatements.
  • Break statement use to break the execution of code in a switch statement and then control will leave that switch statement.
  • Goto Statement is used to pass the control from one case statement to the next case statement.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *