C# vs Java Programming Construct
Programming Construct Both programming language makes use of constructs in controlling the flow of the execution of a program based on whether a certain condition is satisfied or not. They both make use of the selection, looping and branching constructs. Selection construct - which executes a particular block based on a Boolean condition, example of selection construct similar in both languages are: if, if… else, switch…case constructs. If selection construct int num = -4; if (num < 0) { Console.WriteLine(“The number is negative”); } Looping construct - which enables you to iteratively or repeatedly execute a single statement or a block of statements,example of looping construct similar in both C# and Java are: while, do...while, for, enhanced for looping construct. public int val = 1; while (val <= 10) { Console.WriteLine(num); val++; } } Branching construct - These are used to transfer control from one point in a program to another, example