Use an embedded switch statement to execute steps

Uses a switch structure to directly execute steps when a condition is met, without jumping to other steps.

Explore further

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

Code sample

YAML

- step1:
    assign:
      - a: 1
- step2:
    switch:
      - condition: ${a==1}
        steps:
          - stepA:
              assign:
                - a: ${a+7}
          - stepB:
              return: ${"increase a to:"+string(a)}
- step3:
    return: ${"default a="+string(a)}

What's next

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