A topic, and method that I do not see used much anymore, is error checking, this is a very simple challenge that I am presenting today, however I thought it would be a good idea to post it because it is a very good skill to have, and also can save your program for people that launch it to just try and break it, the method of error handling is like jumping in real life, you don’t tend to do it or atleast need to do it, but when there’s an obstacle in the way that requires you to jump, you need to be able to avoid that obstacle quickly by being able to jump higher than that object, in the same way, error handling is a very important skill that will save you even having to encounter them obstacles (obstacles have now turned into errors) because you can avoid them by adding in error checking.
But since you need something to error check, I’ll make a base foundation or something you could do so that I don’t leave you hanging on a challenge that has no jist, I advise that more advanced people also practice this because it is very important to add error checking to everything you do to prevent that crash screen that no one likes to see, to minimise errors for people playing your game or using your program, which keeps them happy, and the program being able to do what it was purposed for without constant, very small errors that causes the whole program to terminate itself.
So because this is a beginner tutorial after all, I will keep it simple, all you’d need to do is:
Make a program that will only accept the string “pineapple” and everything else that is inputted will just be dismissed with the message “Wrong input”, Even though the target audience is beginners to get them in the feel early on, as well as advanced users to boost the skill and practice it, this can still be considered too easy so for an added challenge that is still within beginner range, simply just make it only accept string input for the code that needs to be inputted and the minute a number is entered, the console is cleared, and a message displays reminding the user that the only type of user input that is allowed is string input, do everything you can to make the program crash proof whilst revising organisational skills because if you ever come down to having to share your program or code with another developer so they can continue or add things to your code, if you do not keep it simple, categorised and organised into sections they will struggle to understand your code and it will cause problems and deficiencies, this challenge is more getting into the jift of making things easier for others in the case of sharing your code and making your program crash proof, they’re both very important things that could be practiced more often so you can maximise your program or games efficient whilst making it equally easier for others to make changes to your code efficiently as it would be easy to read.
-Tidy your code
-Convert the string input to all lower case to prevent errors in syntax.
-Add as much error checking as possible and then try to crash your program
-Make it so the only type of input that is accepted is a string, and the minute a number or special character is entered, it is deleted.
Very easy challenge, however the skills that you’ll learn as a beginner from this challenge can really help you later in your programming career, and for the already pros, it is still healthy to practice these skills now and then and make sure to use them in everything you create.
Thank you, I hope your all having a good day, please, if there is a mistake in this writing send me a PM and I will correct it as soon as possible, goodluck guys.
If there are any beginners that do not understand what to do, you can rather ask me through PM for help on how to do what I am asking, or just type or lessons regarding error checking and then try to complete this challenge, if you can’t find a suitable guide and I am unavailable, I am sure there are other people on this form that are kind enough to help you with any issues that you may have, again, have a nice day, I wish you all goodluck, have fun programming!