CASE

CASE Loop or Statements

CASE Loop or statements is a conditional statement. 

Like IF loop or statement these also works in the manner that once the statement is true then some statements are executed other wise the else part will be executed. But in the case of CASE we can consolidate muliple levels of IFloops in one CASE. Some programming languages like C its called as SWITCH - CASE loop but in Navision or Microsoft Dynamics NAV we called this as CASE only.

Syntax of CASE 

-----------------------------------------------------------

        CASE Expression OF

               Value Set 1 : Statement 1;

               Value Set 2 : Statement 2;

                 ...

               Value Set n : Statement n;

             ELSE Statement n+1;

         END 

-----------------------------------------------------------

A sample program for the CASE is as follows

==============================================================

     CASE Color OF 

          Color :: Orange:

                             MESSAGE('COLOR IS ORANGE');

          Color :: Red,Color :: Green:

                             MESSAGE('COLOR IS RED OR GREEN');

            ELSE

                             MESSAGE('COLOR NOT ORANGE,RED OR GREEN');

      END

==============================================================

Related Posts with Thumbnails