.ModelicaReference.'while'

Information

Repeat statements as long as a condition is fulfilled

Examples

    Integer i;
  algorithm
    i := 1;
    while i < 10 loop
      i := i + 1;
      ...
    end while;

Syntax

  while expression loop
    { algorithm ";" }
  end while

Description

The expression of a while clause shall be a scalar Boolean expression. The while-clause corresponds to while-statements in programming languages, and is formally defined as follows

  1. The expression of the while clause is evaluated.
  2. If the expression of the while-clause is false, the execution continues after the while-clause.
  3. If the expression of the while-clause is true, the entire body of the while clause is executed (except if a break statement or return statement is executed), and then execution proceeds at step 1.

Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos