while statement

Syntax
WhileStatement :
   while Expression : NEWLINE
   INDENT
   (Statement | Expression)+
   DEDENT

A while loop begins by evaluation the boolean loop conditional expression. If the loop conditional expression evaluates to true, the loop body block executes, then control returns to the loop conditional expression. If the loop conditional expression evaluates to false, the while expression completes.

Example:

contract Foo:

    pub fn bar() -> u256:
        let sum: u256
        while sum < 10:
            sum += 1
        
        return sum