Skip to content

Support for Compound Conditions In WHILE Loops #396

@x87

Description

@x87

Introduce WHILE OR and WHILE AND variations of WHILE loop with support for multiple conditions.

Current state

https://docs.sannybuilder.com/language/control-flow/loops#while..end

Proposed Syntax

WHILE OR
  <cond 1>
  <cond 2>
  ...
  <cond N>
DO
  <loop body> // execute while at least one condition is true
END
WHILE AND
  <cond 1>
  <cond 2>
  ...
  <cond N>
DO
  <loop body> // execute while all conditions are true
END

DO keyword is needed to separate a condition list from the loop body.

Workround

WHILE TRUE
   IF OR/AND
    <conds>
   THEN
     <loop body>
   ELSE
      BREAK
   END
END

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions