Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When I learned programming, getting arrays was one of my first "aha" moments. Moving from x0, x1, x2, x3 to x[0], x[1], x[2] was definitely enlightening.

My guess is that for simple programs, you almost never have to index an array by a dynamic expression, so you don't see a need for that.



Same here, I remember when I was learning, before I knew what arrays were I had a bunch of variables like that: $x1, $x2 and I was trying to find a way to convert a number like $n into the variable name so I could do $x$n to reference $x1, $x2. I knew what I was trying to do, just didn't know how to do it correctly at the time because I didn't have any exposure to arrays before.


Exactly ! Syntax and meta-syntax are sometimes easy to mix.


I learned math before programming. I already knew sequences and matrices written a_i and a_ij, and arrays were obvious.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: