Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Anytime :)
It's called a ternary operation; it's a short-hand if else statement. The syntax is as follows:
Boolean ? True : False
. It's a pretty old operation and is used in Java, JavaScript, CoffeeScript, C++, Ruby and others.The code above
arr[5]=="loses" ? one-two : one+two;
first looks at the boolean expression before the question mark and if it evaluates as true, then it look at the first statement after the question mark. If the boolean expression is false, it will look at the second statement after the question mark.It's equivalent to
For more information, you can read about it here, and here.