GeeCON Prague 2014*
The moose likes Cattle Drive and the fly likes Question about a nitpick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Question about a nitpick" Watch "Question about a nitpick" New topic
Author

Question about a nitpick

Tony VanHorn
Ranch Hand

Joined: Dec 13, 2006
Posts: 74
I am struggling seeing this from a different perspective. I have a section of code that executes atleast once, but maybe twice and thats all. The two ways I have thought of this is:


or

So, anyone with another idea of how to handle this without a loop or repeated code? Any "hint" in the right direction would be greatly appreciated.
Dick Summerfield
Ranch Hand

Joined: Oct 04, 2007
Posts: 90
Originally posted by Tony VanHorn:
I have a section of code that executes at least once, but maybe twice and thats all.


Seems to me your second example does exactly what you want, Tony.
To compare it with what you say above:

So, anyone with another idea of how to handle this without a loop or repeated code? Any "hint" in the right direction would be greatly appreciated.

Not another idea but I seems like the way to go...
Tony VanHorn
Ranch Hand

Joined: Dec 13, 2006
Posts: 74
yeah, so that was the way to go, the issue i had was my line of code was too long to repeat twice. I found in another thread that pulling that line of code into a method and then just calling the method twice would be a better choice. Thanks for the input.

Tony
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about a nitpick