Chaga Programming Language: Chapter 3

Functions and Procedures

  • Functions and procedures allow one to define a series of programming statements as a subroutine. This technique promotes modularity and reduces code duplication.
  • Functions and procedures are invoked from a calling program using the CALL statement.
  • Functions and procedures both acccept zero or more inputs paramemters.
  • Functions return one or more parameters to the calling program.
  • Procedures do not return a value to the calling program.

DEFINE statement

  • define function identifier (parameter list) return (parameter list) {statement block}
  • define procedure identifier (parameter list) {statement block}

CALL statement

  • call identifier (parameter list);

RETURN statement

  • return identifier;
  • return (identifier list);

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