I began programming in IBM/LCSI PC Logo. The first line of code I ever wrote was:
That's the "hello, world" of turtle graphics in Logo. That simple line of code changed my world. I could make stuff happen in an otherwise mostly blank monochrome CRT display. Until then I had seen CRTs in televisions where I had very little control on what I see on the screen. But now, I had control. The turtle became my toy and I could make it draw anything on a 320 x 250 canvas.
The next beautiful piece of code I came across in the same language was:
REPEAT 360 [FD 1 RT 1]
The code above draws an approximation of a circle by combining 360 short line segments. It showed me how control flow can be used elegantly to express complex ideas in a simple expression. And then I came across this:
REPEAT 20 [REPEAT 180 [FD 1 RT 2] RT 18]
The above code draws 20 overlapping circles. The output looks like this:
Logo gave me a brief taste of functional programming even though back then I did not know the term "functional programming". I discovered the same simplicity and elegance later in Lisp about 15 years later. After all, Logo can be thought of as a dialect of Lisp without parentheses that controls a turtle.
At an impressionable age of 9, reading and writing code like this, and using simple arithmetic, geometry, logic, and code to manipulate a two-dimensional world had a lasting effect on me. Back in those days, I used to find joy in sharing some of my interesting Logo programs with my teachers and friends. I like to believe that my passion for software engineering as well as my love for writing code, sharing code, and open source development are a result of coming across these beautiful code examples early in my life.