validates if, else, and while statements