X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=informqr%2Finformqr.md;h=c43d0c4e1e58877454b3d45b1302fb1cb31086c2;hb=92cfa50b5bb99a38f735143485e1cc9588930a39;hp=e12df8ef2e569a5f453f424ed9918e42b9078151;hpb=3dc602a32e499c052bff366b93bd53effdf2ec38;p=inform-resources.git diff --git a/informqr/informqr.md b/informqr/informqr.md index e12df8e..c43d0c4 100644 --- a/informqr/informqr.md +++ b/informqr/informqr.md @@ -1,4 +1,4 @@ -o% Inform in four minutes +% Inform in four minutes % Roger Firth A quick reference to the Inform programming language. @@ -359,4 +359,69 @@ or an explicit return statement: To define a dummy standalone routine with N local variables (unless it already exists): - Stub routine N; \ No newline at end of file + Stub routine N; + +Flow control +------------ + +To execute statements if *expr* is true; optionally, to execute other +statements if *expr* is false: + + if (expr) + statement_block + if (expr) + statement_block + else + statement_block + +To execute statements depending on the value of *expr*: + + switch (expr) { + value: statement; ... statement; + value: statement; ... statement; + ... + default: statement; ... statement; + } + +where each *value* can be given as: + + constant + lo_constant to hi_constant + constant,constant, ... constant + +Loop control +------------ + +To execute statements while *expr* is true: + + while (expr) + statement_block + +To execute statements until *expr* is true: + + do + statement_block + until (expr) + +To execute statements while a variable changes: + + for (set_var : loop_while_expr : update_var ) + statement_block + +To execute statements for all defined objects: + + objectloop (variable) + statement_block + +To execute statements for all objects selected by *expr*: + + objectloop (expr_starting_with_variable) + statement_block + +To jump out of the current innermost loop or switch: + + break; + +To immediately start the next iteration of the current loop: + + continue; \ No newline at end of file