

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ESE^
1
Limitations of sequential programming Cannot choose whether or not to performa command/instruction Cannot perform the same command morethan once Such programs are extremely limited!
ESE^
2
Control Structures ^ Allow a program to base its behavior oncertain conditions ^ Two kinds:^ ^ Conditional (If) Statements^ ^ Loop Structures
ESE^
3
Recap: Boolean
^ The following expression each give a
Boolean^ result:
(25 > 24)^ &&
(12 == 13) //results to
false
(25 > 24)^ ||
//results to
true
ESE^
4
ESE^
5
//Assume^
x^ is^ an^ integer if(x^ >^ 10)
{ x = x * 2;System.out.println(“x
=^ “^ +^ x); }
If the condition is true, then the statement(s) (i.e.instructions) will be executed. Otherwise, it/they won’t.
ESE^
6
If statement (contd..)
x^ is^ an^
integer if(x^ >^ 0)System.out.println(x
+^ “^ is^ positive”);
ESE^
7
“if-else” statement //Assume^
x^ is^ an^ integer if(x^ >^ 0)
{ System.out.println(x
+^ “^ is^ positive”); } else^ { System.out.println(x
+^ “^ is^ negative”); }
if (condition){statement(s)} else^ (condition){statement(s)}