var spawn = SKAction.runBlock self.spawnPipes if var == true {...}
or (and I have actually seen this) if (<expression> == true) {
return true;
} else {
return false;
}
I sometimes think that simply giving those 5 lines to a person and observing if they make a face like you've handed them a bucket full of day-old fish is a better test for programming aptitude than anything. if var == true {...}
In some languages var might be truthy but not equal to true. The falsy values may be more of a problem at times.However in the strongly typed swift I don't think it will be a problem as I suspect (but haven't read/tested enough yet to confirm) that only false and nil will be falsy and that comparison with true will throw errors if var isn't of bool type.
3 == true // Give an error (operator overload doesn't cover this)
true == 3 // Returns false
nil == false // Returns false
You can't use nil or integers directly in an if statement without a function to return a logic value.But the branch and explicit boolean comparison are additional structural complexity (not just "verbosity") and invariably harms readability to me. Care give a poster child example for where it helps readability? Unless it's unclear <expression> results in a boolean - a problem better solved through better naming - code like this forces me to perform the equivalent simplification in my head to understand and reason about the code, a process fraught with error and distraction from my actual task.
return expression;
What readability does the verbosity add?