error in my code.I can't understand the error.

Paying attention to where the { and } go would be useful. While they are optional for some statements, it is a good idea to ALWAYS use them, even when they only encompass a single line of code.