New course! Every coder should learn Generative AI!
Try a free lesson+ 1
After a method ends, everything that's in there disappears.
So basically, that is all that happens.
And if you want to save something from the method and use it later, you need to return it.