I don’t know if “ternary operators” exist in Monkey, but you get the idea, to do boolean check and assignment in one line. I don’t know if I remember correctly, that in MonkeyX this feature was supported.
Other alternative way I found is this, which adds some unnecessary complexity.