Timeline for Order to teach looping constructs in a non ideal language
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 30, 2018 at 13:49 | comment | added | Buffy | But don't miss the point that the question was about classifying loops. An infinite loop should clearly say, semantically or syntactically, that "this loop is infinite". Controlling it specifically with a variable says just the opposite. It is about the meaning of the code, not just about how it plays out. Students (and professionals) often write infinite loops by mistake, forgetting to change a condition in some way. Your technique works only in a language that can clearly specify a constant value. For example an alternate symbol for True. | |
| Jan 30, 2018 at 13:27 | comment | added | Petter Brodin | Yeah, that's definitely possible, though on the other hand that could be used as a lead-in to the difference between an infinite loop and one that eventually terminates. "Up until now we've said that programShouldRun is always True, but what do you think happens if we set it to False at the bottom of the loop?" Alternatively: "So, this program runs forever, but we want to exit when [thing we are looking for]. Does anyone have any idea about how we'd go about fixing that?" | |
| Jan 30, 2018 at 12:25 | comment | added | Buffy | Hmmm. If programShouldRun is a variable then this isn't specifically an infinite loop. It may turn out to be, but that depends on the future possible value of the variable. Constants are possible in Python, but a deeper concept and language specific, of course. | |
| Jan 30, 2018 at 12:18 | review | First posts | |||
| Jan 30, 2018 at 14:42 | |||||
| Jan 30, 2018 at 12:12 | history | answered | Petter Brodin | CC BY-SA 3.0 |