Forums Register Login

for loop

+Pie Number of slices to send: Send
Hi,

What does this statement mean....In Java, a while loop cannot have an empty condition but a for loop can. Can you give examples please???


Thanks
+Pie Number of slices to send: Send
Example of a for loop with empty condition:



That for loop is perfectly acceptable, although it is an infinite loop. However, the following while loop is not valid:



This will not work. You have to have some sort of boolean, or expression that results in a boolean, in the while condition.
+Pie Number of slices to send: Send
 

W. Joe Smith wrote:Example of a for loop with empty condition:


This will not work, because there is one ; too many.
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 771 times.
Similar Threads
java.sql.SQLException: Missing IN or OUT parameter at index::
WA #2 ..... word association
for loop within a while?
Dynamic link in JSP
Batch Update question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:29:30.