silly goose meekahM to bad code • 2 years agoIf only there was a common feature of programming languages to create a loop that executes until a certain condition is met...i.imgur.comimagemessage-square3arrow-up114arrow-down10
arrow-up114arrow-down1imageIf only there was a common feature of programming languages to create a loop that executes until a certain condition is met...i.imgur.comsilly goose meekahM to bad code • 2 years agomessage-square3
minus-square@fubolinkEnglish3•2 years agoI once had a programming student do this sort of thing: done = False step = 1 while not done: if step == 1: # ... do something ... step = 2 elif step == 2: # ... do something else ... step = 3 # ... and so on ... Effectively he’d reinvented state machines!
minus-squaresilly goose meekahOPMlinkEnglish1•2 years agoSounds like that student just didn’t know how to do it properly yet, but this was done by someone with several years of experience. What he did all those years, however, is a mystery to me.
I once had a programming student do this sort of thing:
done = False step = 1 while not done: if step == 1: # ... do something ... step = 2 elif step == 2: # ... do something else ... step = 3 # ... and so on ...
Effectively he’d reinvented state machines!
Sounds like that student just didn’t know how to do it properly yet, but this was done by someone with several years of experience. What he did all those years, however, is a mystery to me.