Monday, January 3, 2011

jBase Infobasic Function CASE

The CASE statement allows the programmer to execute a particular sequence of instructions based upon the results of a series of test expressions.

Command Syntax

BEGIN CASE
CASE expression statement(s)
CASE expression
statement(s)
. . .
END CASE

Syntax Elements

The BEGIN CASE and END CASE statements bound the CASE structure. Within this block, an arbitrary number of CASE expression statements may exist followed by any number of jBASE BASIC statements. The expression should evaluate to a TRUE or FALSE result. The evaluation of each expression at execution time is in order. If the expression returns a TRUE result, it then executes the statements below. On completion of the associated statements, execution will resume at the first statement following the END CASE.

NOTES: A default action (to trap error conditions for instance) may be introduced by using an expression that is always TRUE, such as CASE one. This should always be the last expression in the CASE block.

Command Syntax

BEGIN CASE
CASE A = 1
CRT "You won!"
CASE 1
CRT "You came nowhere"
END CASE
A single comment is printed depending on the value of A.
NOTE: that if A is not 1 then the default CASE 1 rule will be executed as a "catch all".

0 comments:

Post a Comment

 

Blog Info

A Pakistani Website by Originative Systems

Total Pageviews

Tutorial Jinni Copyright © 2015 WoodMag is Modified by Originative Systems