Casio FX-890P Owner's Manual page 113

Casio personal computer owner's manual
Table of Contents

Advertisement

if() else
PURPOSE: Executes one statement when the specified condition is true (not zero).
A second optional statement following the "else" is executed when the specified
condition is false (0).
FORMAT:
if (condition) statement 1 else statement 2
PARAMETERS:
Condition can be any variable or expression that will be considered true if not 0.
EXPLANATION:
1. The most simple conditional structure is: if (condition) statement.
statement is executed only if condition is true (not 0)
2. You can add the else structure to process the case of condition being false
(0).
3. Statement 1 and statement 2 can be if() then structure as well, allowing
analyzing and processing multiple conditions.
4. The last else statement is often here to process unexpected entries or data
configurations, for example generating an error warning.
SAMPLE PROGRAM:
/* if() else example */
/* upper case only! */
/* #include <stdio.h> */
main(){
char c;
c=getchar();
if ((c>='A')&&(c<='Z') {
/* Process upper case */
. . .
}
else if((c>='a')&&(c<='z')){
/* Change case */
c-=32;
. . .
}
else {
printf("%c is not a letter¥n",c);
}
}
SEE: switch() case break default
113

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents