Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, March 12, 2015

What is #elif directive ?

#elif is a preprocessor directive which is used create “if – else if” statements for testing multiple conditions
.
Syntax:
#if condition_1
     statement_1;
     ……………….
     statement_N;
#elif condition_2
     statement_1;
     ………………………….
     statement_N;
…………
………….
#elif condition_N
     statement_1;
     ……………………………
     statement_N;
#endif

Ex:
#if DAY == 1
     #define TODAY “MONDAY”
#elif DAY == 2
     #define TODAY “TUESDAY”
#elif DAY == 3
     #define TODAY “WEDNESDAY”
#elif DAY == 4
     #define TODAY “THURSDAY”
#elif DAY == 5
     #define TODAY “FRIDAY”
#elif DAY == 6
     #define TODAY “SATURDAY”
#elif DAY == 7
     #define TODAY “SUNDAY”
#else
     #define TODAY “INVALID DAY”
#endif


No comments:

Post a Comment