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.
The specialized functions are introduced in later katas in the series.
The point of this kata is to write the given function. The point of this kata is not boolean arithmatic.
You misunderstand what's being practiced in the kata. This kata is not about performing simple math. This kata teaches how to use multiline functions in Java. If someone performs the extremely silly activity of detecting the input and manually setting the area then returning it, they'll still have used multiline functions in Java.
But also, the only people who are going to be trying to hard-code area based on the limited input sets are people who are intentionally trying to break the kata and definitely don't need the practice. It's actually easier to just do the math. I see no reason to guard against such people since, again, they still did what the kata actually cared about (multiline function programming).
Missing random tests (since hardcoding of the returned value is still vulnerable)
Missing random tests (since hardcoding of the returned value is still vulnerable)
The == comparison at the beginning is checking if the address is the same. While it would mean that both arguments are the same -- and therefore a draw -- it would fail if these were two separately allocated strings that contain the same value.
wow!
I love how you changed the paramter to 'bool' to match the function name
yes
There is reverse method. Damn. I used sort
This comment is hidden because it contains spoiler information about the solution
For simple statements like this, it's quite pythonic to put it on one line. Even for more complicated statements with ifs and for loops and generators, it is still often pythonic to put it on one line.
YMMV in other languages.
I don't know about industrial programming, but here it is often done like this
Q: How conventional is it to have this on one line over multiple? Apologies if this is a silly question - still learning. :)
Not bad at all! Short, sweet and to the point!
Loading more items...