0% found this document useful (0 votes)
11 views

JAVA DecisionMakingAndIterations

This document discusses different types of constructs used in ABC programming including decision making statements like if and switch, iteration constructs like while, do and for loops, and jump constructs like break and continue. It provides examples and explanations of how to use if statements, switch-case statements, while loops, do-while loops, for loops, and break and continue statements.

Uploaded by

Phuong Le
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

JAVA DecisionMakingAndIterations

This document discusses different types of constructs used in ABC programming including decision making statements like if and switch, iteration constructs like while, do and for loops, and jump constructs like break and continue. It provides examples and explanations of how to use if statements, switch-case statements, while loops, do-while loops, for loops, and break and continue statements.

Uploaded by

Phuong Le
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 10

Decision Making and Iterations

ABC programming lesson.

Types of Constructs

Decision Making Statements The if and switch statements Iteration Constructs The while, do, for, and foreach statements Jump Constructs The goto, break, and continue statements

FPT- APTECH

2/10

if statements

No implicit conversion from int to bool


int x; ... if (x) ... // Must be if (x != 0) in Java if (x = 0) ... // Must be if (x == 0) in Java

FPT- APTECH

3/10

switch - case statements

Use switch statements for multiple case blocks Use break statements to ensure that no fall through occurs

FPT- APTECH

4/10

Iteration Constructs

The while Statement The do Statement The for Statement

FPT- APTECH

5/10

Iteration Constructs while statements

Execute embedded statements based on Boolean value Evaluate Boolean expression at beginning of loop Execute embedded statements while Boolean value Is True

FPT- APTECH

6/10

Iteration Constructs do statements

Execute embedded statements based on Boolean value Evaluate Boolean expression at end of loop Execute embedded statements while Boolean value is True

FPT- APTECH

7/10

Iteration Constructs for statements

Place update information at the start of the loop Variables in a for block are scoped only within the block A for loop can iterate over several values

FPT- APTECH

8/10

break and continue statements

The break statement jumps out of an iteration The continue statement jumps to the next iteration

FPT- APTECH

9/10

Thats about all for today!

Decision Making Statements Loops Jump Statements

Thank you all for your attention and patient !

You might also like