Welcome to the Ranch
You shouldn't write code the way you think
You should write code. Most people think you write code like this
. . . but you shouldn't That is how you would write a letter, but that method makes it easy to get your {} paired incorrectly. Write it like this
That way you will always have the {} in pairs. Make sure to indent them correctly; MS NotePad is no used for that; try NotePad2 or NotePad++ or jEdit, which support bracket highlighting, automatic indentation, etc.