Skip to content

Condition on optional field #3360

Answered by slewiskelly
MichaelStetner asked this question in Q&A
Discussion options

You must be logged in to vote

Either of the following should work:

#Person: {
	name: string
} | {
	name:     string
	employed: bool

	if employed == true {
		jobtitle: string
	}
}
#Person: {
	name:      string
	employed?: bool

	if employed != _|_ {
		if employed == true {
			jobtitle: string
		}
	}
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MichaelStetner
Comment options

Answer selected by MichaelStetner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants