I was always fascinated with technology. I grew up watching Start Trek and imagined exploring distant places of universe. Closest thing to science fiction back in the days (late 80s, early 90s) were computers. So, you can imagine how happy and proud I was when my older sister decided to study computer science in college.
Of course, I was curious about computers and programming and she absolutely had to show me what’s it all about. She was learning BASIC back then and showed me some instructions and programs written in it.We did not have a computer, so we did it on paper. It was all very easy and clear to me, until we got to the problem of calculating a sum of integers from 1 to N.
I could solve it using the mathematical formula (N+1) * (N/2), but in the book there was a solution with using the FOR loop and this line in the middle of it:
S = S + i
It was the toughest line of code for me. It bugged me for years. I memorized it, and knew that’s how things work, but couldn’t figure out why. How is it possible? How could S be equal to S + i? Wouldn’t that be true only if i is zero? I was thinking mathematically and S being equal to anything other then S was impossible for me to comprehend.
I can’t remember the exact moment in my life when I finally understood how this line of code really works. But I sure do remember it as my first ever programming challenge.