This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Query on 4b (Say) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Query on 4b (Say) "unrolling loops" nitpick" Watch "Query on 4b (Say) "unrolling loops" nitpick" New topic
Author

Query on 4b (Say) "unrolling loops" nitpick

Rian Nolan
Greenhorn

Joined: Jun 21, 2006
Posts: 9
I'm a bit befuddled in 4b(Say) at the moment.
I have it "working" in the broadest possible sense, but I'm obviously overcomplicating matters somewhat, as one of the nitpicks was:
You are putting a whole lot of effort into setting things up so you can use a loop... 3 times. 4 at the most.
I'd like you to "unroll" the loop, hard code each instance, and we'll take it from there.

...and I'm not not quite sure how to "unroll" a loop (or loops)
Should I go from this:

to (something like) this:

Any advice on unrolling loops?
Should I stop rolling my own?
Cheers,
Brian.
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1660
    
  11

I just want to say that I don't know the answer... and I hate Say b.

And.... if you're not looping, then why the heck does 'i' make a difference anyways... can't you just do the stuff without looping it?


When you do things right, people won't be sure you've done anything at all.
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1358
    
  17
What Janeice said (no, not the censored bit!)

you don't need i, just do something like this.



If you get stuck, ping your nitpicker for hints, or ask obliquely here on the forum!
Gary Ba
Ranch Hand

Joined: Oct 23, 2009
Posts: 150

random reply to your quesetion...

I too had a difficulty with Say b so your not the only one.

Garry


star chaser..
Rian Nolan
Greenhorn

Joined: Jun 21, 2006
Posts: 9
Found these threads which managed to cover off all of my concerns about unrolling loops and not using ternary operators:
Nice to know that I'm not completely off the beaten track!
Math, Ternaries, Passing and Returning
Say 4b - completely stumped
...so attempt#2 with ifs everywhere, and nested loops unrolled is on its way...
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1358
    
  17
Rian, I promise it's worth it. I know it feels just awful to hard code it like that... but there are efficiencies and beautiful things on the other side that you just cannot get to while you have that loop in place. Promise.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query on 4b (Say) "unrolling loops" nitpick