Is it possible to have an extension function on a ...
# announcements
a
Is it possible to have an extension function on a lambda be inline? E.g.
Copy code
typealias Block = ()->Unit
inline fun unless(p: Boolean, b: Block) { if(!p) b() }
//and then I can use it within a function to breakout as
unless (false) { return } 
// but I would like something like
{ return } unless (false)
// I tried doing
inline infix fun Block.unless(p: Boolean) { if(!p) this() }
// But then when using it as `{ return } unless (false)` it will say 'return' is not allowed here because the lambda is not inlined I'm guessing