Documentation for version v0.42.0 is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
If Statements
Refer to Starlark if statement specification for details.
- if
#@ if True:
test1: 123
test2: 124
#@ end
- if (negative)
#@ if not True:
test1: 123
#@ end
- single-node if
#@ if/end True:
test1: 123
- if-else conditional
#@ if True:
test1: 123
#@ else:
test2: 124
#@ end
- if-elif-else conditional
#@ if True:
test2: 123
#@ elif False:
test2: 124
#@ else:
test2: 125
#@ end
- if-elif-else conditional boolean (and/or)
See Starlark or/and operators for more details.
#@ test = 123
#@ if test > 100 and test < 200:
test1: 123
#@ elif test == 100 or test == 200:
test2: 124
#@ else:
test3: 125
#@ end
- single line if
#@ passwd = "..."
test1: #@ passwd if passwd else assert.fail("password must be set")
- implicit if
#@ passwd = "..."
test1: #@ passwd or assert.fail("password must be set")
(Help improve our docs: edit this page on GitHub)