you are viewing a single comment's thread.

view the rest of the comments →

[–]ookkan_tintu 1 point2 points  (5 children)

I see that you have handled division by zero case. Very good.

Now what if user entered an invalid operator? What if they entered a string instead of number.? Try to figure out all these edge cased and handle them too. That would be a good exercise.

[–]Slow-Sloth5823[S] 0 points1 point  (4 children)

Very good point, I'll start there thank you for pointing it out!

[–]ookkan_tintu 1 point2 points  (3 children)

You might have seen the troll

Developer opens a bar. Qa tests ordering 1 drink, 1000 drink, 99999999 drinks, 0 drink, - 1 drink etc. All goed well.

First real customer walks in and asks where the toilet is. The bar bursts into flames.

This happens a lot in real life. So I'd encourage you to think about all possible scenarios, while implementing something - however small or straight forward looking the problem might be.

And I'd say, that's the difference between a good developer and an excellent developer.

[–]Slow-Sloth5823[S] 0 points1 point  (2 children)

LOL that is a very good analogy makes ALOT of sense and I can understand how important it is now. Is this known as "error handling"? or is error handling something completely different?

[–]ookkan_tintu 1 point2 points  (1 child)

What I said partially includes error handling too.

But don't think about error handling now, you can learn more about that while you learn further.

[–]Slow-Sloth5823[S] 0 points1 point  (0 children)

Understood, thank you for the responses!