OSDN Git Service

SourceForge.JP で Mac 旧来の改行コード( CR のみ)の場合に正常に処理されないので、改行コードを変更。
[bacon/BaCon-Japanese.git] / 関数・命令 / IF.txt
1   IF
2
3    IF <expression> THEN
4        <body>
5    [ELIF]
6        <body>
7    [ELSE]
8        [body]
9    ENDIF | END IF | FI
10
11    Type: statement
12
13    Execute <body> if <expression> is true. If <expression> is not true then
14    run the optional ELSE body. Multiple IF's can be written with ELIF. The
15    IF construction should end with ENDIF or END IF or FI. Example:
16
17    a = 0
18    IF a > 10 THEN
19        PRINT "This is strange:"
20        PRINT "a is bigger than 10"
21    ELSE
22        PRINT "a is smaller than 10"
23    END IF
24
25    If only one function or statement has to be executed, then the
26    if-statement also can be used without a body. For example:
27
28    IF age > 18 THEN PRINT "You are an adult"
29    ELSE INPUT "Your age: ", age
30
31    Use with care as nested IF/THEN statements using one function may
32    confuse the parser.
33