Quote (Minkomonster @ Mar 6 2014 11:43pm)
Seems very backwards to me. Iterative loops are just special types of conditional loops. Logical flow of learning would be from conditional loops, to conditional loops that iterate over a collection, to iterative loops
Code
int i = 0, n = 5;
while(i < n)
{
do_stuff();
i++;
}
becomes
Code
for(int i = 0, n = 5; i < n; i++)
{
do_stuff();
}
While leads to more in depth discussion on when and where you use each loop, why a while is better vs a for loop or vice versa.
I would be curious to know your professor's answer as to why he feels for loops should be taught first. Seems like you are moving backwards in that case, doesn't it?
sometimes teachers teach to the test, so to speak, and don't really teach students what's really happening. IIRC the intro class i had in college taught for loops first because it was easier for them. memorize this syntax and it'll just work, vs pay attention to your while condition, increment some variable, and understand what's really happening.
on a tangent, i visited my high school when i was a college student. i remember most of the math class in high school seemed to think induction could only be used to prove formulas like sum(1 to n) = n*(n+1) /2. the teacher never gave them any other kind of example.