1. The if selection (single-selection statement) statement performs (selects) an action if a condition is true or skips the action if the condition is false. 2. The ifelse (double-selection statement) selection statement performs an action if a condition is true and performs a different action if the condition is false.
as ifelse Selection Statement The ifelse selection statement allows you to specify that a different action is to be performed when the condition is true than when the condition is false. For example:
operands. The operands together with the ?: form a conditional expression. The first operand is a boolean expression, the second is the value for the conditional expression if the expression evaluates to true and the third is the value for the conditional expression if the expression
evaluates to false. Nested if...else Statements Nested ifelse statements test for multiple cases by placing ifelse statements inside ifelse statements.
Dangling-else Problem The following code illustrates the dangling-else problem. For example, The interpreter interprets the preceding statement as
while Repetition Statement A repetition structure (also known as a loop) allows you to specify that a script is to repeat an action while some condition remains true. The statement is as follows:
Any statement of the form where operator is one of the binary operators +, -, *, / or % Increment and Decrement Operators
Formulating Algorithms: Counter-Controlled Repetition Consider the following problem statement:
Formulating Algorithms: Sentinel-Controlled Repetition Consider the following problem: Develop a class-averaging script that will process an arbitrary number of grades each time the script is run. Nested Control Statements
Essentials of Counter-Controlled Repetition Counter-controlled repetition requires: 1. The name of a control variable (or loop counter). 2. The initial value of the control variable.
3. The increment (or decrement) by which the control variable is modified each time through the loop (also known as each iteration of the loop). 4. The condition that tests for the final value of the control variable to determine looping should continue.
for Repetition Statement General Format of a for Statement Summing Integers with a for
Statement Calculating Compound Interest with the for Statement Consider the following problem statement:
switch Multiple-Selection Statement We create these different lists using the CSS property list-style-type, which allows us to set the numbering system for the list.
Possible values include decimal (numbersthe default), lower-roman (lowercase Roman numerals), upper-roman (uppercase Roman numerals), lower-alpha (lowercase letters), upper-alpha (uppercase letters), and more. dowhile Repetition Statement
In the while statement, the loop-continuation test occurs at the beginning of the loop, before the body of the loop executes. The dowhile statement tests the loop-continuation condition after the loop body executestherefore, the loop body always executes at least once.
break and continue Statements break Statement The break statement, when executed in a while, for, dowhile or switch statement, causes immediate exit from the statement.
Execution continues with the first statement after the structure. continue Statement The continue statement, when executed in a while, for or dowhile statement, skips the
remaining statements in the body of the statement and proceeds with the next iteration of the loop. In while and dowhile statements, the loopcontinuation test evaluates immediately after the continue statement executes.
In for statements, the increment expression executes, then the loop-continuation test evaluates. Improper placement of continue before the increment in a while may result in an infinite
The logical operators are && (logical AND), || (logical OR) and ! (logical NOT, also called logical negation). && (Logical AND) Operator || (Logical OR) Operator
Acute Triangle. Each angle is acute. All angles less than 90° Obtuse Triangle. One angle is obtuse. It has an angle greater than 90° Right Triangle. One angle is a right angle. One angle is exactly 90°
From the Founder of General Systems Theory. Ludwig von Bertalanffy. A system may be defined as a set of elements standing in interrelation among themselves and with environment. We term a system 'closed' if no material enters or leave it;...
SIS doesn't support non-credit courses / experiential learning. Forced to use workarounds (special topics, directed studies) Students and faculty frustrated by courses listed but not offered. Organizations, People. ... Kuali Student at UBC
Point-to-point tunneling protocol (PPTP) Protocol of PPP encapsulation over IP designed by Microsoft. Allow to set the virtual private networks (VPNs) over a public network. The protocol opens two channels of communication between the client and server: a channel control...
Boys tend to bully with direct bullying or physical or verbal aggression. Girls tend to bully with indirect means such as social aggression. Boys who bully tend to be 1 to 2 years older than their victims. Their victims can...
The Statistical Database covers the region and contains over 600 data series on a wide range of topics on population, education, health, poverty and inequalities, gender, economy, environment and connectivity
Introduction to Computing CS A109 Course Objectives Goal is to teach computation in terms relevant to non-CS majors Students will be able to read, understand, modify, and assemble from pieces programs that achieve useful communication tasks: Image manipulation, sound synthesis...
Ready to download the document? Go ahead and hit continue!