Syntax #1 is preferred (assuming this is a simplified example — otherwise indeed @uniment’s is best!). Syntax #3 is parsed as
a==1 ? return (true : return false)
i.e., with :
as a range, which is then a syntax error because the ternary operator ?
doesn’t have its other half (:
).