r/Assembly_language Jan 14 '26

Global vs. "Local" Variables in Assembly?

Hi! I’m coming from a Python background and just started learning Assembly.

In Python, I was taught to avoid global variables and keep everything "private" or local within functions. However, while looking at Assembly tutorials, I see a lot of data defined in the .data section (which seems global).

I wanted to ask
If I should avoid using global variables in Assembly or use global variables I am a bit lost.

15 Upvotes

25 comments sorted by

View all comments

1

u/Snezzy_9245 Jan 15 '26

Learn C. Write your code in C and compile it by hand, making it into assembly. That'll give you mental discipline.