for statement

Syntax
ForStatement :
   for IDENTIFIER in Expression : NEWLINE
   INDENT
   (Statement | Expression)+
   DEDENT

A for statement is a syntactic construct for looping over elements provided by an array type.

An example of a for loop over the contents of an array:

Example:

contract Foo:

    pub fn bar(values: u256[10]) -> u256:
        let sum: u256
        for i in values:
            sum = sum + i

        return sum