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

I need help with this. I intuitively count with starting at one.

In a for loop, if we start with 0, then the terminating condition is i less than n.

However, ifvit starts at 1, then the terminating condition is i less than or equal to n.

What mental trick do you use to remember that?



n is n steps ahead of 0,and thats what < checks for.




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

Search: