objective c - What is this short function doing ? (_bird.physicsBody.velocity.dy < 0 ? 0.003 : 0.001) -
this question has reply here:
what question mark , colon (?: ternary operator) mean in objective-c? 10 answersi studying code noticed next function.
obviously, short form of something, have never come across this.
what < 0 ? 0.003 : 0.001 ? can explain in plain english? give thanks you.
(_bird.physicsbody.velocity.dy < 0 ? 0.003 : 0.001)
this code:
(_bird.physicsbody.velocity.dy < 0 ? 0.003 : 0.001) is same as:
if (_bird.physicsbody.velocity.dv < 0) { homecoming 0.003; } else { homecoming 0.001; } objective-c
No comments:
Post a Comment