#Check if bool is not null and true (shorthand)?
1 messages · Page 1 of 1 (latest)
1 messages · Page 1 of 1 (latest)
I have a variable var b: ?bool and want to check if it's both not null and true
I'm currently doing:
if (b != null and b) ...
Is there a shorthand way to do this?
I could also do if (b orelse false) but that seems less clear, to me.
Actually the first one doesn't even work
you can just do b == true
For an optional?
yes