preview

Nt1310 Unit 5 Programming Language Analysis

Decent Essays

When the sequential execution of the program flow breaks, the control jumps to another part of the program such type of branching is known as conditional branching. On the other hand, if the branching happens unconditionally, then it is known as unconditional branching. The decision making statements supported by most of the programming languages include: 1. if statement 2. switch …case statement if statement The if statement is one of the vital among decision making statements and it is mainly used for controlling the execution flow of statements within a program. It is a two-way decision making statement that is used in conjunction with test expression. The general form is given as: if (test expression) then clause else clause Here the test expression is first evaluated and then based on the result or value returned, (true or false), the program control is …show more content…

• How “then” and “else” clauses stated? • How should the importance of nested selectors be stated? In most of the programming languages, then clause and else clause is a compound or a single statement. However, in case of Perl, all of these clauses have to be compound statements though it may have single statements. Braces are used in most of the programming languages that indicates the body of then and else clauses. The compound statements are specified by the use of indentation in case of Python, like: if x < y: x = y print “case n” Note that all the compound statements are given equal indentation. Instead of writing the then clause, colon is made used especially in Python. Simple if statement The syntax for simple “if” statement is given as: if

Get Access