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

Chapter 3 Notes

Uploaded by

Demon God
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Chapter 3 Notes

Uploaded by

Demon God
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Conditional Statements

Types

if-else Switch
if-else

if(Condition) {
//do something if TRUE
}
else {
//do something if FALSE
}

Ele is optional block


can also work without {}
else if

if(Condition 1) {
//do something if TRUE
}
else if (Condition 2) {
//do something if 1st is FALSE & 2nd is TRUE
}
Conditional Operators
Ternary
Condition ? doSomething if TRUE : doSomething if FALSE;

give 1 & 0 cases


Conditional Operators
switch
switch(number) {
case C1: //do something
break;
case C2 : //do something
break;
default : //do something
}
Conditional Operators
switch Properties

a. Cases can be in any order

b. Nested switch (switch inside switch) are allowed

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy