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.
Can you please explain to me the last line? I have never used the class called pairs or used a method called map. Please help
Anytime :)
Oh Wow. That is a very handy concept. I will use that from now on.
Thank you very much for taking your time :3
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.
What is the second last line doing? I have never seen the use of those question marks and ' : ' in c#
Is that some kind of new feature?
As a beginner of foreach statements, i find this rather fascinating :3