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.
Same! It's just so satisfying.
thanks :)
Nice work, looks clean :)
god i love these so much. there is just something i love about code in one line.
This comment has been deleted.
Of course! ... a switch case statement was a better option, veryt clean and a go to way of doing things when the options are predefined.
Because some are paid by amount of lines, so checks you can sell as maybe necessary come in handy. Also giveaway for this is 3 lines for the test instead of one.
$this->check(basicOp('/', 4, 0), 0);
Division by zero :(
Thank you for your comment.
I put this solution to solve the kata only and didn't think about best solutions.
Your piece of code is really clear and I already put it in my toolbox. (y)
I'll try to use your solution in the next time.
You can use less commands when making sure $char is not more than 255. Just use $char = ++$char % 256; -- this way it is shorter, cleaner and is only one command instead of if/else. Just an advice.
This is not real-world programming, so no need to check if the variable is empty or null. I don't understand why do people often do this in problems, I mean it is certain there won't be any error in input data, unless it is specified in the task. Remove this check and you have a lot shorter, cleaner and better solution. I didn't mean to abuse you, it's just a shout-out to everybody who does it.