Talk:Inverted syntax: Difference between revisions

→‎The C example: no need for example if it's not there
(→‎The C example: no need for example if it's not there)
Line 74:
 
:Well, it doesn't say that do-while is the same, it only says it's the closest C comes to inverted syntax. True, it might mislead people not familiar with the language. --[[User:Oenone|Oenone]] 06:33, 5 September 2012 (UTC)
 
:: I don't know, given that the provided example has just the right bug, I'm not sure the original author ''didn't'' consider them exactly the same. Anyway, since they are not the same thing, there's no point of mentioning them in this task "just because". If someone ''has'' to put something under the C heading, it's probably better to stress their difference rather than similarity, along the lines of:<lang c>#include "stdio.h"
 
int main(void)
{
int i;
 
// seemingly unreachable loop
i = 0;
while (i < 0) { i++; }
printf("while{}: i = %d\n", i);
 
puts("");
i = 0;
do { i++; } while (i < 0);
printf("do{}while: i = %d\n", i);
 
// if iterator is modified inside while()
puts("");
i = 3;
while (--i) { printf("while{}: i = %d\n", i); }
 
puts("");
i = 3;
do { printf("do{}while: i = %d\n", i); } while (--i);
 
return 0;
}</lang>
Anonymous user