Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 761 Bytes

lang-ref-if.md

File metadata and controls

63 lines (48 loc) · 761 Bytes

If conditional

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
  • 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")