Toughest line of code

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.

Published
Categorized as Life

By Aleksandar Jakovljević

My name is Aleksandar Jakovljević and I am a web developer from Belgrade, Serbia. I was born in Smederevo, in 1980. I started focusing on web development since late 2003. I am mostly focused on open source web technologies. I specialised in PHP, focusing on Symfony framework, with skills in Drupal and WordPress, too. I worked more than 7 years for art_net studio and 10 years for Computer Rock (former Spoiled Milk). Now I am working on developing industry leading subscription management system as a part of Plenigo team since August 2021. I love the web and everything related to it. The possibility to publish your ideas quickly and make them available to the entire world is what made me decide to pursue a career in web development.

Follow on: Twitter | GitHub | LinkedIn | Facebook | Instagram

Hire me on Upwork

Leave a comment

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.