function-definition is not allowed here before '{' token ERROR

alright,
this is the only error i am facing and this only the full code.

apologize if i wrote something wrong