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

When I first learned programming YEARS ago starting with Acorn BBC Basic it actually took me quite some time before I learned how to do 'proper' loops (e.g for , while etc).

I was initially far more interested in how I could change the colours of things on screen and get the speaker to make funny noises. Most of what I wrote were text based adventure games so I didn't really need to loop very often.

When I did need to loop I just implemented this using a conditional IF with a GOTO that jumped back to the start of the "block" (I kept paper notes as to which line numbers each subroutine started on) if required or continued to the next line of code.

Later when I started using MS Visual Basic and figured out how to use GOSUB I would do loops essentially with recursion that would call the same subroutine again if required.

It wasn't until I decided to learn C and php that I learnt about real loop structures. At this point I assumed that everything I had done before was stupid and wrong, it was not until I took formal CS classes where I was introduced to recursion and assemly language (JMP and JE) that I realised that pherhaps I hadn't been quite so naieve before.



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

Search: