Codeasy.net C# Beginner – Input Validation
Day 46 #100DaysOfCode
Learning how to set up a program for input validation has been a great way to learn proper structuring of the code I lay down.
I had to write a program that would declare a valid Battleship(game)-style grid call as input by the user. My early attempts, while quite successful, were long, and drawn out. I compacted as best as I could but still had too many individual sections to be able to pass. My code was not concise enough yet. I ultimately needed to see the answer to understand how to fit all the criteria for a valid input into a one-line comparison.
Taking what I learned from re-writing my Battleship program I launched into the next task program, which was a password validator. I knew this one would be coming. I set up the basic outline of how I saw it working, filled in the key lines of code I knew I would need, then tested some things out. After some tweaking and balancing: done. I was honestly surprised when I submitted it for review, but it came back as a PASS.