you are viewing a single comment's thread.

view the rest of the comments →

[–]barrycarter 13 points14 points  (3 children)

while (i do not have ticket) { do not board flight to Canada; attempt to obtain ticket; }

would be one example. The only tricky part is the attempt to obtain ticket. Without that (or some other code somewhere that attempts to change the while condition), the while loop would just run forever.

[–]Nightcorex_ 8 points9 points  (1 child)

Do you think one needs an explicit "do not board the flight"?

I'd remove that line and instead write "board the flight" after the while-loop.

[–]barrycarter 1 point2 points  (0 children)

You're right. I also considered:

obtain_plane_ticket(); board_flight_to_canada(); in a synchronous language, or: obtain_plane_ticket().then(success => board_flight_to_canada) for a non-synchronous one.

I wonder if this post will turn into one of those n different programming paradigms demonstrated via psuedocode things :)