Talk:Loops/N plus one half: Difference between revisions

Line 13:
 
:Hi Ce, if what you are after, is to get a conditional within a loop that causes only one of two actions to be done for the last iteration of the loop then the task descriptions use of the term "n+1/2" and even a revised name "Loop and a half" suggest looping (n times), then doing something else, which is counter to the rest of the description. The pattern name is counter to the actions required. --[[User:Paddy3118|Paddy3118]] 05:47, 6 November 2009 (UTC)
 
:: While "n+1/2" was a mis-remember from my side, "Loop and a half" seems to be the common name of the pattern. You may not like it, but being the commonly used name, it's the one to use.
:: Also note that in most languages (namely all having a "break" or similar) arguably the best solution is not to make the second part a conditional, but to make a conditional break in the loop (because that more clearly communicates that you leave the loop afterwards). Of course, SESE purists may differ. --[[User:Ce|Ce]] 13:53, 6 November 2009 (UTC)
973

edits