error compiling

You haven't declared a variable called "key4".
That's why the compiler is complaining.

I'm complaining about the format of your code, which the IDE's auto-format tool will help you sort out.