選擇案例

出自 ArcoWiki
於 2018年6月15日 (五) 09:37 由 Slia (對話 | 貢獻) 所做的修訂 (创建页面,内容为“The construct '''Select Case''' is the technique to condition the execution of a program depending the value of a certain variable. <code><span style="color…”)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)
前往: 導覽搜尋

The construct Select Case is the technique to condition the execution of a program depending the value of a certain variable.

$$ Example of Select Case

DECL/INTGR,i
DECL/CHAR,50,tx
i=ASSIGN/10
SELECT/i
$$ i is the variable that controls the part program behavior
CASE/10
$$ If the i value is equal to 10
tx=ASSIGN/CONCAT('THE ACTUAL VALUE OF X IS: ',STR(i))
TEXT/OPER,tx
ENDCAS
CASE/20
$$ If the i value is equal to 20
tx=ASSIGN/CONCAT('THE ACTUAL VALUE OF X IS: ',STR(i))
TEXT/OPER,tx
ENDCAS
DFTCAS
TEXT/OPER,'X is not equal to the 2 cases'
ENDCAS
ENDSEL