Codeasy.net C# Beginner – Input Validation
Day 46 #100DaysOfCode
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2019/12/2019-12-28_codeasy_beginner_input_validation_battleship-1.png?resize=425%2C208&ssl=1)
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.
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2019/12/2019-12-28_codeasy_beginner_input_validation_password.png?resize=505%2C297&ssl=1)
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.