đź’ľ

002. My very first day: Pascal, Fibonacci, and the Magic of Recursion



TL;DR

  • First programming experience in secondary school, with Pascal and recursion.
  • Learned the basics of logic, structure, and recursion through the Fibonacci function.
  • That day sparked a lifelong passion for coding and problem-solving.


It was a quiet afternoon in secondary school when I was first introduced to the world of programming. The computer room smelled of old CRT monitors and excitement. The teacher wrote something strange on the whiteboard:


function Fibonacci(n: integer): integer;
begin
  if n <= 1 then
    Fibonacci := n
  else
    Fibonacci := Fibonacci(n - 1) + Fibonacci(n - 2);
end;

And just like that, my journey into coding began—with Pascal and a recursive Fibonacci function.


Why Pascal?

Back then, Pascal was the language of choice in Vietnamese schools for its structured syntax and educational design. It wasn’t flashy, but it was readable. For a beginner, that mattered. It taught me logic, clarity, and structure—qualities that continue to shape my development style even today.


program FibonacciDemo;
var
  i, n: integer;
begin
  write('Enter number of terms: ');
  readln(n);
  for i := 0 to n - 1 do
    writeln('F(', i, ') = ', Fibonacci(i));
end.

Understanding Recursion

At first, recursion blew my mind. The idea that a function could call itself felt almost magical. I remember running the Fibonacci function with n = 5, tracing each call on paper like a detective solving a mystery:


F(5) → F(4) + F(3)
F(4) → F(3) + F(2)
F(3) → F(2) + F(1)
…

It was confusing but fascinating. I began to understand how computers think—how they stack function calls and unwind them, one step at a time.


Lessons I Learned That Day

  • Start small, think deeply: A simple function like Fibonacci taught me recursion, base cases, performance concerns (hello, exponential growth!), and stack overflow.
  • Every language is a tool: Pascal was just the beginning. Later I moved on to C#, PHP, and JavaScript—but the foundation was universal.
  • Never forget your roots: I still keep a framed certificate from that year on my wall—a reminder of when it all began (as in the photo above).

Looking Back with Gratitude

Now, as a professional developer optimizing backend systems and working with modern stacks, it’s easy to get lost in the complexity of DevOps pipelines and cloud infrastructure. But I’ll never forget that first moment of joy when I made a machine compute Fibonacci numbers—just by telling it how.


That was the moment I knew: I didn’t just want to use computers.

I wanted to command them.



<- Back to blog