You can make the function lose
a one-liner using the ternary operator in Swift. Here's how you can achieve that:
main.swift96 chars2 lines
Note that the above code is already a one-liner. The function lose
returns !powerupactive && touchingeagle
which is a boolean value.
If you need a separate one-liner expression that assigns the result to a variable, you can use the ternary operator as follows:
main.swift60 chars2 lines
This assigns true
to result
if !powerupactive && touchingeagle
evaluates to true
, otherwise it assigns false
.
Let me know if you need any further assistance!
gistlibby LogSnag