Use a basic for-range loop

Uses range-based iteration.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

YAML

- assignStep:
    assign:
      - sum: 0
- loopStep:
    for:
      value: v                    # required, v = 1, 2, …, 9
      range: [1, 9]               # inclusive beginning and ending values
      steps:
        - sumStep:
            assign:
              - sum: ${sum + v}   # v = 1, 2, … 9
- returnStep:
    return: ${sum}                # sum is 45

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.