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.
return ends a function, you would only go to the next line if it didnt return
Оставшаяся часть кода после return не будет выполнятся, программа выйдет из функции, поэтому это работает без написания else
Not sure which language you use but in JS it is not expecting an empty array.
This is the test:
return -1 is ours else
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
There's a difference between the normal
if: else:
statement in Python and this. This is specifically what is called a "ternary operator", and it's a different syntax for a different operation (although it does similar things.https://www.geeksforgeeks.org/ternary-operator-in-python/
It's a bit of a shame that Python uses the same tokens
if
andelse
for both the conditional statement and the ternary operator - most languages don't, and it does make it confusing.