Why does the instruction "do" require a "while"?

Posted by 909 Niklas on Programmers See other posts from Programmers or by 909 Niklas
Published on 2013-10-13T04:54:15Z Indexed on 2013/11/11 22:12 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

Since this statement is so common:

while (true) (Java)

or

while (1) (C)

or sometimes

for (;;)

Why is there not a single instruction for this? I could think that an instruction that could do it is just do but do requires a while at the end of the block but it would be more logical to write an infinite loop like this

do {

//loop forever

}

Why not? AFAIK the instruction do always requires a while at the end but if we could use it like above then it would be a clear way to define something like while (true) which I think should not be written like that (or for (;;)).

© Programmers or respective owner

Related posts about java

Related posts about c