Hey how do I correctly use nonlocal for a variable or is it used for functions?

Hi @ooooooooooooooooooof,

Could you post a link to the exercise this is on?

I’m was trying to make my own code but I found a way around that.You see, I was trying to make a Pokemon Battle Simulator but the hp kept reverting back to normal so I looked up attributes and stuff that would help and nothing did so I got creative…I set up a while loop inside a function which had multiple other functions inside and because of the while loop the hp’s data was trapped inside the function having no way to revert.

Turns out Nonlocal is for Python 3
Which would have been very useful if the site had listed that… :frowning:

1 Like

But thanks for the concern

This topic is solved.