I would read `foo.if { bar() }` as return `foo` if...
# announcements
p
I would read
foo.if { bar() }
as return
foo
if
bar()
is true
g
Thinking of which, isn't that bad of a concept actually
Just hard to deal with on a control-flow approach if there is no
else
case, unless it returned
null
p
yeah, the result would have to be a nullable type which is suboptimal
👍 1
a
that's how ternary operator in python works:
foo if condition else bar
g
Being able to assign
if-else
and
when
blocks is a nice feature, but i'd like to be able to use
condition ? foo : bar
instead of
if (condition) foo else bar
for the same reason that i like python ternary over C/Java ternary.