Use an expression to assign a variable value

Uses an expression to assign the value of a variable previously defined.

Explore further

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

Code sample

YAML

- get_message:
    assign:
      - name: "Harsha"
      - last_name: "Kapoor"
      - full_name: ${name+" "+last_name}
      - temperature_C: 27
      - temperature_F: ${temperature_C * 9/5 + 32}
      - temperature_msg: ${"Current temperature is "+string(temperature_F)+" F"}
- return_value:
    return: ${temperature_msg}

What's next

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