RosettaCodeData/Task/Inverted-syntax/Julia/inverted-syntax.julia

8 lines
229 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
macro inv(expr, cond)
cond isa Expr && cond.head == :if || throw(ArgumentError("$cond is not an if expression"))
cond.args[2] = expr
return cond
end
@inv println("Wow! Lucky Guess!") if true else println("Not!") end