, <=, >=, ==, and !=. It also covers logical operators like &&, ||, and !. It provides examples of using these operators in expressions and evaluating boolean values. It describes using while loops with counter-controlled iteration to repeat actions while a condition remains true.">, <=, >=, ==, and !=. It also covers logical operators like &&, ||, and !. It provides examples of using these operators in expressions and evaluating boolean values. It describes using while loops with counter-controlled iteration to repeat actions while a condition remains true.">
[go: up one dir, main page]

0% found this document useful (0 votes)
5 views80 pages

Week4 Combine

The document discusses relational and logical operators used in high-level programming. It covers relational operators like <, >, <=, >=, ==, and !=. It also covers logical operators like &&, ||, and !. It provides examples of using these operators in expressions and evaluating boolean values. It describes using while loops with counter-controlled iteration to repeat actions while a condition remains true.

Uploaded by

raley
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)
5 views80 pages

Week4 Combine

The document discusses relational and logical operators used in high-level programming. It covers relational operators like <, >, <=, >=, ==, and !=. It also covers logical operators like &&, ||, and !. It provides examples of using these operators in expressions and evaluating boolean values. It describes using while loops with counter-controlled iteration to repeat actions while a condition remains true.

Uploaded by

raley
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/ 80

HIGH-LEVEL PROGRAMMING I

Relational & Logical Operators


by Prasanna Ghali
Relational Operators
2

 Relational operators allow you to make


comparisons
Operator Description
< Less than
these 4 operators have similar > Greater than
precedence but lower than
<= Less than or equal to
arithmetic operators
>= Greater than or equal to
these 2 operators have similar == Equal to
precedence but lower than 4
!= Not equal to
operators listed above

Left to right associative order


Relational Expressions (1/2)
3

 Relational expression evaluates to value 0 if it


is false, or 1 if it is true
Expression Meaning Value
8 < 15 8 is less than 15 1
6 != 6 6 is not equal to 6 0
2.5 > 5.8 2.5 is greater than 5.8 0
5.9 <= 7.5 5.9 is less than or equal to 7.5 1
ASCII value of 'A' is greater than or
'A' >= 'Z' 0
equal to 'Z'
Relational Expressions (2/2)
4

 Given int a = 3, b = 8, c = 1;
what is value of following expressions?

Expression Meaning Value


a==b==c
a>=b!=b<=a
a < 10 < b
(a < 10) != (10 < b)
Boolean Values in C89
5

 Older C standards did not have Boolean type


 Hacks involving preprocessor were required to

simulate Boolean type and values


#define TRUE (1)
#define FALSE (0)
#define BOOL int
if (flag == TRUE) {
// do this thing ...
} else {
// do other thing ...
}
Boolean Values in C99 and C11
6
(1/2)
 Boolean type introduced in C99: _Bool
 C++ provides Boolean type bool and

keywords true and false to indicate values


1 and 0, respectively
 C99 provides new header file <stdbool.h>
that supplies macros bool, true, and false
 This is handy and we’ll use these macros often

through the rest of this semester


Boolean Values in C99 and C11
7
(2/2)

int year = 2021;


// does year represent centennial?
bool flag = year % 100 == 0; // flag is false
printf("flag: %d\n", flag); // prints 0 to stdout
Compound Conditions
8

 Often, you need to evaluate more than one


expression to determine whether an action should
take place
 If you worked more than 40 hours and you’re not
a manager, you get overtime pay
 If you make less than $100,000, you pay 10%
tax; more than $100,000 but less than
$1,000,000, you pay 15% tax
 If you were speeding and your speed is less than
twice posted speed limit, you get $100 ticket;
otherwise you get $500 ticket
Logical Operators
9

 Logical operators allow you to combine


expressions

Unary operators have higher Operator Description

precedence order
high to low
precedence than binary
operators ! Not
&& And
These 2 operators have lower || Or
precedence than relational
operators which in turn have
lower precedence than
arithmetic operators
Understanding AND Logic (1/3)
10

 Basic monthly cell phone service bill is $40


 Additional $20 billed to customers making

more than 100 calls that last for total of more


than 500 minutes
 Require ability to write following expression
required:
 (calls_made > CALLS) AND (call_minutes > MINUTES)

 This is done in C/C++ as:


 (calls_made > CALLS) && (call_minutes > MINUTES)
Understanding AND Logic (2/3)
11

 All listed conditions must be met for resulting


action to take place!!!

x y x && y Value
true true true 1
true false false 0
false true false 0
false false false 0
Understanding AND Logic (3/3)
12

 Each part of logical expression is evaluated


only as far as necessary to determine whether
entire expression is true or false
 Referred to as short-circuit evaluation
 Additional $20 billed to customers making
more than 100 calls that last for total of more
than 500 minutes
 (calls_made > CALLS) && (call_minutes > MINUTES)

Not evaluated if customer has


not made more than 100 calls
Understanding OR Logic (1/3)
13

 Basic monthly cell phone service bill is $40


 Additional $20 billed to customers making more than
100 calls or send more than 200 text messages
 Require ability to write following expression
required:
 (calls_made > CALLS) OR (texts_sent > TEXTS)
 This is done in C/C++ as:
 (calls_made > CALLS) || (texts_sent > TEXTS)
Understanding OR Logic (2/3)
14

 Only one of the listed conditions must be met


for resulting action to take place!!!

x y x || y Value
true true true 1
true false true 1
false true true 1
false false false 0
Understanding OR Logic (3/3)
15

 Short-circuit evaluation implemented here too


 Each part of expression is evaluated only as far as
necessary to determine whether entire expression is
true or false
 Additional $20 billed to customers making more
than 100 calls or send more than 200 text
messages
 (calls_made > CALLS) || (texts_sent > TEXTS)

Not evaluated if customer has


made more than 100 calls
Understanding NOT Logic (1/2)
16

 Reverses meaning of logical expression


 !(a == b) is same as (a != b)

x !x Value
true false 0
false true 1
Precedence Table: Arithmetic,
17
Relational, and Logical Operators

Operator(s) Description
! + - Logical negation, unary plus and minus
* / % Multiplication, division, remainder
precedence order
high to low

+ - Addition, subtraction
Less than, less than or equal to, greater
< <= > >=
than, greater than or equal to
== != Equal to, not equal to
&& Logical AND
|| Logical OR
Relation and Logical Expressions
18
(1/2)
Expression Value
!('A' > 'B')
!(6 <= 7)
!7 > !6 !0 is true !7 means false

14 >= 5 && 'A' < 'B'


24 >= 35 && 'A' < 'B'
14 >= 5 || 'A' > 'B'
24 >= (35 || 'A') > 'B'
'A' <= 'a' || 7 != 7
Relation and Logical Expressions
19
(2/2)
 Given int a = 3, b = 8; what is value
of following expressions
true = 1
false = 0

Expression Meaning Value


!a > b 0

1
!(a > b)
a < 10 < b
a < 10 && 10 < b
true false
0

!a != !b 0
0
0
HIGH-LEVEL PROGRAMMING I
while Loop by Prasanna Ghali
Iteration Structure
2

 Repeat actions while a condition remains true

expression statement
true
false

while (expression)
statement
statement or
block of statements delimited by braces
while Loop (1/2)
3

int i = 0; 1

while (i < 20) { // initialize loop control variable(s)


2
// expression tests loop control variable
print("%d ", i); while (expression) {

statement
i += 5; 3
} // update loop control variable
output
}
0 5 10 15
while Loop (2/2)
4

 What is printed to standard output and what is


value of i after conclusion of loop?

int i = 0;
while (i <= 20) {
print("%d ", i);
i += 5;
}
Type 1: Counter-Controlled while
5
Loops
 You know how many times certain things need
to be done
// initialize N to specify how many
// times certain things need to be done

// initialize loop control variable


counter = 0;

// test loop control variable


while (counter < N) {
// do the thing ...

// update loop control variable


counter += 1;
}
Type 1: Counter-Controlled while
6
Loops: Computing Average
 You know how many times certain things need
to be done
int counter = 0, sum = 0;
printf("Enter %d integers\n", N);
while (counter < N) {
int temp;
scanf("%d", &temp);
sum += temp;
counter += 1;
}

double average = (double)sum/N;


printf("sum: %d | average: %.2f\n", sum, average);
Type 1: Counter-Controlled while
7
Loops: Checkerboard Pattern
 You know how many times certain things need
to be done int main(void) {
printf("Enter rows and cols: ");
int rows, cols;
printf("rows: %d | cols: %d\n", rows, cols);
int r = 0;
while (r < rows) {
int c = 0;
while (c < cols) {
putc('*', stdout);
c = c + 1;
}
putc('\n', stdout);
r = r + 1;
}
}
Type 2: Sentinel-Controlled while
8
Loops
 You don’t know how many times certain things
need to be done
int sentinel = -1;
printf("Enter integers ending with %d: ", sentinel);
int num;
scanf("%d", &num);

int sum = 0, count = 0;


while (num != sentinel) {
sum += num;
scanf("%d", &num);
count += 1;
}
double average = (double)sum/count;
printf("sum: %d | average: %.2f\n", sum, average);
Type 3: Flag-Controlled while
9
Loops
 Flag-controlled while loop uses boolean
variable to control loop
// initialize loop control variable
bool found = false;

// test the loop control variable


while (!found) {
...
// update loop control variable
if (expression)
found = true;
...
}
Type 3: Flag-Controlled while
10
Loops – Number Guessing Game
srand(time(0)); // seed random number generator
int num = rand() % 100;
bool have_guessed = false;
while (!have_guessed) {
printf("Enter a number between 1 and 100: ");
int guess;
scanf("%d", &guess);
if (guess == num) {
prinf("You guessed correct value: %d\n", guess);
have_guessed = true;
} else if (guess < num) {
printf("Your guess is lower than number\n");
} else {
printf("Your guess is higher than number\n");
}
}
Type 4: EOF Controlled while
11
Loops (1/2)
 Algorithm to implement file copy by copying
one character at a time from input to output
file
1) read character from input file
2) while (character is not end-of-file indicator)
3) write character read to output file
4) read next character
Type 4: EOF Controlled while
12
Loops (2/2)
 Flag-controlled while loop uses boolean variable
to control loop

#include <stdio.h>
#include <stdio.h>
int main(void) {
int main(void) {
int ch = getchar();
int ch;
while (ch != EOF) {
while ((ch = getchar()) != EOF) {
putchar(ch);
putchar(ch);
ch = getchar();
}
}
return 0;
return 0;
}
}
Infinite Loops
13

 If controlling expression never evaluates to


false, you get an infinite loop
int i = 1;
 Example 1: while (i != 10)
i += 2;

int i = 0;
 Example 2: while (i < 10);
printf("i is %d\n", ++i);

while (1)
 Example 3: printf("Infinite loop ...\n");
HIGH-LEVEL PROGRAMMING I
Conditional Operator by Prasanna Ghali
Reference
2

 Conditional operator is explained in Chapter 5 of


the text
Purpose
3

 Write certain if statements with else clauses


more concisely

int max(int x, int y) {


int m; char grade(double pts) {
if (x > y) { if (pts >= 70.0) {
m = x; return 'P';
} else { } else {
m = y; return 'F';
} }
return m; }
}
Conditional Operator: Syntax (1/2)
4

 expression1 ? expression2 : expression3

int max(int x, int y) {


int m;
if (x > y) { int max(int x, int y) {
m = x;
int m;
} else {
m = x > y ? x : y;
m = y;
} return m;
return m; }
}
int max(int x, int y) {
return x > y ? x : y;
Terser but better
}
Conditional Operator: Syntax (2/2)
5

 expression1 ? expression2 : expression3


char grade(double pts) {
if (pts >= 70.0) {
return 'P';
} else {
return 'F';
}
}

char grade(double pts) {


return (pts >= 70.0) ? 'P' : 'F';
}
Conditional Operator and
6
Expression
 Syntax for using conditional operator is
expression1 ? expression2 : expression3
 Evaluation proceeds as follows:
 expression1 is fully evaluated and tested against
zero
 If evaluation of expression1 is not equal to zero,
expression2 is evaluated and its value is result of
entire expression; expression3 is not evaluated
 If expression1 is zero, expression3 is evaluated
and its value is result of entire expression; expression2
is not evaluated
Precedence and Associativity
7

Operator Meaning Associativity


! + - logical negation unary plus, unary minus R-L
* / % multiplication, division, remainder L-R
+ - addition, subtraction L-R
relational L-R
precedence order
high to low

< <= > >=


== != equivalence L-R
&& logical AND L-R
|| logical OR L-R
?: conditional (ternary) R-L
= assignment R-L
Conditional Operator and
8
Expression: Example
if (x > y) {
printf("x is larger\n");
} else {
printf("y is larger\n");
}

x > y ? printf("x is larger\n")


: printf("y is larger\n");
Conditional Operator and
9
Expression: Example

if (x > y) {
z = x + 2;
} else {
z = y + 5;
}

z = x > y ? x + 2 : y + 5;
Conditional Operator and
10
Expression
 Write function signum that returns 1, -1, or 0
depending on whether its argument is positive,
negative, or zero
int signum(int x) { int signum(int x) {
if (x > 0) return 1; if (x > 0) return 1;
else if (x < 0) return -1; if (x < 0) return -1;
else return 0; return 0;
} }

int signum(int x) {
return (x > 0) ? 1 : (x < 0) ? -1 : 0;
}
Computing Maximum of 3 Integral
11
Values (1/3)
if (x > y) {
if (x > z) {
max = x;
} else {
max = z;
}
} else {
if (y > z) {
max = y;
} else {
max = z;
}
}
max = x > y ? x>z ? x : z : y>z ? y : z;
Computing Maximum of 3 Integral
12
Values (2/3)

max = x > y ? x>z ? x : z : y>z ? y : z;

max = (x > y) ? (x>z) ? x : z : (y>z) ? y : z;

max = ((x > y) ? ((x>z) ? x : z) : ((y>z) ? y : z));


Computing Maximum of 3 Integral
13
Values (3/3)
max = ((x > y) ? ((x>z) ? x : z) : ((y>z) ? y : z));

 Rather than using conditional operator, this is


much better:
int max(int x, int y) {
return x > y ? x : y;
}

int max3(int x, int y, int z) {


return max(max(x, y), z);
}
Conditional Operator and
14
Expression: Exercises
 If a = 1 and b = 0, what are values of a, b and
c after following statements?

Statement a b c
c = a == b ? a + 2 : b + 5;
c = a = b ? a + 2 : b + 5;
c = a = b ? a + 2 : b += 5;
c = (a = b) ? (a + 2) : (b += 5);
HIGH-LEVEL PROGRAMMING I
for Looping Structure by Prasanna Ghali
while Loop Structure
2

 Repeat actions while a condition remains true

expression statement
true
false

while (expression)
statement
for Loop Structure (1/4)
3

 Specialized form of while loop


 Simplifies writing of counter-controlled
initial loops
expression

true
expression statement update expression

initial expression;
false
while (expression) {
statement
update expression;
}
for Loop Structure (2/4)
4

for (initial expression; expression; update expression)


statement

initial
expression

true
expression statement update expression

initial expression;
false while (expression) {
statement
update expression;
}
for Loop Structure (3/4)
5

evaluate initial expression once and only once


evaluate update expression

1
goto step 2 5 4

for (initial expression; expression; update expression)


statement

2
execute statement if evaluation of
expression is true evaluate expression
otherwise, jump out of loop 3
for Loop Structure (4/4)
6

int i = 0;
while (i <= 20) {
printf("%d ", i);
i += 5;
}

for (int i = 0; i <= 20; i += 5) {


0 5 10 15 20 printf("%d ", i);
}
for Loop: Example 1
7

for (int i = 0; i <= 7; i += 1) {


printf("%d squared is %2d\n", i, i*i);
}
0 squared is 0
1 squared is 1
program output
2 squared is 4
3 squared is 9
4 squared is 16
5 squared is 25
6 squared is 36
7 squared is 49
Example 2: Find Sum of 1st N
8
Numbers

printf("Enter number of +ve integers to be added: ");


int N;
scanf("%d", &N);
int sum = 0;
for (int counter = 0; counter < N; counter += 1) {
sum += counter;
}
printf("Sum of 1st %d +ve integers is %d\n", N, sum);
Missing Expressions (1/2)
9

 Any or all of expressions in for statement can be


omitted int i = 1;
for (; i <= 5;) {
printf("%d ", i);
i += 1;
}
 Equivalent to:
int i = 1;
while (i <= 5) {
printf("%d ", i);
i += 1;
}
Missing Expressions (2/2)
10

 This is an infinite loop

for (; ;) {
printf("This is infinite loop ...\n");
}

 Default value of "no expression" in update


expression in for statement is true
HIGH-LEVEL PROGRAMMING I
Selection: if and if-else by Prasanna Ghali
Selection Structure
2

expression expression
true true false
false
statement 1 statement 2
statement

if (expression) if (expression)
statement statement 1
else
statement or statement 2
block of statements delimited by braces
Meaning of C/C++ Statement
3

 statement is: d = sqrt(b*b-4.0*a*c);


;

 expression followed by ;
 Zero or more statements enclosed in
opening brace { and closing brace }

{
{
// empty block
w = x2 - x1;
}
h = y2 - y1;
d = sqrt(w*w + h*h);
}
One Way Selection: if Statement
4

 C/C++ Syntax:
if (expression)
statement expression
true false
statement

 "If expression is true, then


execute statement"
 "If expression is false, then
don’t execute statement"
if Statement: Example
5

 Compute absolute value of a number


int value;
printf("Enter a number: ");
scanf("%d", &value);

int abs_value = value;


if (abs_value < 0) {
abs_value = -abs_value;
}

printf("Absolute value of %d is %d\n",


value, abs_value);
if Statement: Common Error
6

 Common error:
Always true!!! Result of assignment expression is 5
if (health = 5)
printf("You are dead!\n");
 More saner:

if (5 == health)
printf("You are dead!\n");
if Statement: Syntax (1/4)
7

 Recall if statement syntax if (a > b)


if (expression) ;
statement
 statement syntax:
 Zero expression followed by ; if (a > b)
c = 10;
 Expression followed by ;
ifopening
 Zero or more statements enclosed in (a > brace
b) {
{ and closing brace } int c = 10;
a = b*c;
}
if Statement: Syntax (2/4)
8

 Block with single statement


if (a > b)
printf("a = %d, b = %d\n", a, b);

 Block with multiple statements

if (a > b) {
printf("a = %d, ", a);
printf("b = %d\n", b);
}
if Statement: Syntax (3/4)
9

 Empty statements are valid!!!

if (a > b) if (a > b) {
;
}
 Good habit to put single statement in braces!!!

if (a > b) {
printf("a = %d, b = %d\n", a, b);
}
if Statement: Syntax (4/4)
10

 Another common error:

if (health == 0);
printf("You are dead!\n");

Being aware when programming and carefully reading


diagnostic messages from compiler will prevent these
gotchas from spoiling your day
Two-way Selection Structure
11

 C/C++ Syntax:
if (expression) expression
statement 1
else true false
statement 2 statement 1 statement 2

 "If expression is true, then


only execute statement 1"
 "If expression is false, then
only execute statement 2"
Two-way Selection Structure:
12
Example One
is average >=
90?
true false

You pass!!! You fail!!!

int average;
printf("What is your score for HLP1?: ");
scanf(" %d", &average);

if (average >= 90) {


printf("You passed, well done!\n");
} else {
printf("See you next semester...\n");
}
Two-way Selection Structure:
13
Example Two
is d <= 30?
true false
velocity = 0.425 velocity = 0.625
+ 0.00175d2 + 0.12d - 0.0025d2

...

if (d <= 30.0) {
velocity = 0.425 + 0.00175*d*d;
} else {
velocity = 0.625 + 0.12*d - 0.0025*d*d;
}
Multiple Selections: Nested if
14
(1/7)
 Some problems require implementation of
more than two alternatives
 Calculating interest on your bank balance

Checking account balance Interest Rate


< $1,000 0%
$1,000 to $24,999.99 3%
$25,000 to $49,999.99 5%
>= $50,000 7%
Multiple Selections: Nested if
15
(2/7)
double balance, int_rate;

if (balance < 1000.0) {


int_rate = 0.0;
} else {
if (balance < 25000.0) { Checking account balance Interest Rate
int_rate = 0.03; < $1,000 0%
} else {
$1,000 to $24,999.99 3%
if (balance < 50000.0) {
int_rate = 0.05; $25,000 to $49,999.99 5%
} else { >= $50,000 7%
int_rate = 0.07;
}
}
}
Multiple Selections: Nested if
16
(3/7)
double balance, int_rate;

if (balance >= 50000.0) {


int_rate = 0.07;
} else {
if (balance >= 25000.0) { Checking account balance Interest Rate
int_rate = 0.05; < $1,000 0%
} else {
$1,000 to $24,999.99 3%
if (balance >= 1000.0) {
int_rate = 0.03; $25,000 to $49,999.99 5%
} else { >= $50,000 7%
int_rate = 0.0;
}
}
}
Multiple Selections: Nested if
17
(4/7)
double balance, int_rate; double balance, int_rate;

if (balance < 1000.0) { if (balance >= 50000.0) {


int_rate = 0.0; int_rate = 0.07;
} else { } else {
if (balance < 25000.0) { if (balance >= 25000.0) {
int_rate = 0.03; int_rate = 0.05;
} else { } else {
if (balance < 50000.0) { if (balance >= 1000.0) {
int_rate = 0.05; int_rate = 0.03;
} else { } else {
int_rate = 0.07; int_rate = 0.0;
} }
} }
} }
Multiple Selections: Nested if
18
(5/7)
 Alternative indentation that “saves space“
double balance, int_rate;

if (balance < 1000.0) {


double balance, int_rate;
int_rate = 0.0;
} else { if (balance < 1000.0) {
if (balance < 25000.0) { int_rate = 0.0;
int_rate = 0.03; } else if (balance < 24999.99) {
} else { int_rate = 0.03;
if (balance < 50000.0) { } else if (balance < 49999.99) {
int_rate = 0.05; int_rate = 0.05;
} else { } else {
int_rate = 0.07;
int_rate = 0.07;
}
}
}
}
Multiple Selections: Nested if
19
(6/7)
double balance, int_rate;

if (balance >= 50000.0) {


double balance, int_rate;
int_rate = 0.07;
} else { if (balance >= 50000.0) {
if (balance >= 25000.0) { int_rate = 0.07;
int_rate = 0.05; } else if (balance >= 25000.0) {
} else { int_rate = 0.05;
if (balance >= 1000.0) { } else if (balance >= 1000.0) {
int_rate = 0.03; int_rate = 0.05;
} else { } else {
int_rate = 0.07;
int_rate = 0.0;
}
}
}
}
Multiple Selections: Nested if
20
(7/7)
 Grading algorithm for an unknown course in
some unknown school
if (average >= 90.0) {
grade = 'A'; Grade point average Letter grade
} else if (average >= 80.0) { >= 90 A
grade = 'B'; 80 to 89.99 B
} else if (average >= 70.0) {
70 to 79.99 C
grade = 'C';
} else if (average >= 60.0) { 60 to 69.99 D
grade = 'D'; < 60 E
} else {
grade = 'E';
}
Pairing an else with an if (1/3)
21

 How do you (or the compiler) know which else is


paired with which if?
 Remember there’s no standalone else - every else must
be paired with corresponding if
 C/C++ are free form languages, so compilers ignore
indentation - they see just sequence of tokens
if (average >= 90.f)
if (attack > 20)
grade = 'A';
if (damage <= 0)
else if (average >= 80.f)
grade = 'B'; printf("No damage.\n");
else if (grade >= 70.f) else
grade = 'C'; printf("You missed!\n");
else
grade = 'D';
}
Pairing an else with an if (2/3)
22

 In nested if statement, C associates an else


with most recent if not already paired with
else
if (attack > 20) if (attack > 20)
if (damage <= 0) if (damage <= 0)
printf("No damage.\n"); printf("No damage.\n");
else else
printf("You missed!\n"); printf("You missed!\n");

 Left code fragment is equivalent to right code


fragment
 Known as dangling-else problem
Pairing an else with an if (3/3)
23

 What if you didn’t mean this?


 Be explicit!!! Wrap if statement with curly

braces!!!
 Everything in braces becomes one (compound)
statement, so inner if is "hidden" from else

if (attack > 20) {


if (attack > 20) if (damage <= 0)
if (damage <= 0) printf("No damage.\n");
printf("No damage.\n"); } else {
else printf("You missed!\n");
printf("You missed!\n"); }
Summary
24

 Syntactic meaning of C/C++ statement


 if statement and its applications

 if else statement and its applications

 Gotchas to watch out for when writing these


statements
 Big gotcha is dangle else problem

You might also like