wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Stuck again on the Loops Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Stuck again on the Loops" Watch "Stuck again on the Loops" New topic
Author

Stuck again on the Loops

Fitz Herbert
Greenhorn

Joined: Mar 22, 2003
Posts: 21
When a loop will definitely not run due to an argument of false say ? is any compilation errors thrown
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Do you have some sample code as an example of what you're asking?
It's easier to help you with concrete code examples to talk about.


Rob
SCJP 1.4
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

For loops, you will get an "Unreachable statement" compilation error if you use the false literal

If statements (which aren't loops) do accept the literal false as an argument:

Both of these will compile; this is used to mimic C/C++'s conditional compilation:

[ May 29, 2003: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Sometimes yes, sometimes no. Take a look at this thread for a discussion on the subject.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stuck again on the Loops