Chaga Programming Language: Chapter 4: Selection Statements

If-then statement

  • if (expression) then {statement block}

If-then-else statement

  • if (expression) then {statement block} else {statement block}

Switch statement

  • switch (expression) {case constant: statement block break; case constant: statement block break; case constant: statement block break; ... default: statement block break;}
  • switch (expression) {case constant: statement block case constant: statement block case constant: statement block break; ... default: statement block break;}

Break

  • The break statement is used to prematurely leave an iterative loop (e.g. do, for, while) or a switch statement.
  • break;

Copyright © 2025 Robert James Bruce.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at https://www.gnu.org/licenses/fdl-1.3.html