3 ms·
> I remember that in 7th grade when I tried to teach myself programming for the first time, I didn’t realize that you were supposed to reuse variables. I would
by Peaker 15y ago
> I remember that in 7th grade when I tried to teach myself programming for the first time, I didn’t realize that you were supposed to reuse variables. I would just create a new variable for every single value I needed to store. Boy does that seem stupid looking back.
What? Making new variables is better. The compiler will generally figure out the scope of variables and re-use the space taken by variables.
This tends to suggest that at least for him, the functional/immutable meaning of variables was more natural.
- excid3 15y agoThis was a hangman game in GW-Basic. It was the messiest code I've ever written. 38k lines for a simple 3 letter only hangman game.
- nitrogen 15y agoWow, that is indeed impressive. I admire the determination it must have taken to get to 38000 lines of code for a three letter game. Was this text-based or graphical (I can't remember -- did gwbasic even support anything beyond basic CGA video modes?)? Edit: Wait, was that BASIC line numbers reaching to 38000, or 38000 actual individual lines?
- excid3 15y agoErm sorry, it was a 38k source file of text. I was actually hard coding everything because I didn't understand it. the whole screen would get printed out (without any sort of looping) each time you guessed a letter. GW Basic did let you do basic graphics, I eventually got around to emulating a side scroller at one point. Obviously it was just the foreground, but it was quite a lot of fun.
- ars 15y ago> The compiler will generally figure out the scope of variables and re-use the space taken by variables. Maybe today. But back then they certainly didn't.