Can I get a variable declared in a function from another function?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MaaaxiKing

I have declared a variable in function walk() and I want to access it in follow(). Is this possible?

:bust_in_silhouette: Reply From: exuin

No, variables declared in functions are local to that function. You should declare the variable outside a function to use it in multiple functions.

Hm okay, thanks.

MaaaxiKing | 2021-02-06 08:36