Poll: Which is better
for loops
while loops
[Show Results]
Note: This is a public poll, other users will be able to see what you voted for.
Post Reply 
loops
Author Message
Assassinator
...

Posts: 6,646.6190
Threads: 176
Joined: 24th Apr 2007
Reputation: 8.53695
E-Pigs: 140.8363
Offline
Post: #1
loops
So I had this totally retarded conversation today with some guy about whether for loops are better or while loops.

Now I'm here to spread retardation to you, because I have nothing better to do right now (ok, that's a lie I have loads of better stuff I could be doing but whatever).


EDIT: Now color coded and shit to increase your interest in voting (lol).... yeah.
(This post was last modified: 10/03/2012 04:53 AM by Assassinator.)
10/03/2012 03:20 AM
Find all posts by this user Quote this message in a reply
Rawrsor
Let it snow
Fractal Insanity

Posts: 1,718.4848
Threads: 36
Joined: 13th Apr 2011
Reputation: -6.78081
E-Pigs: 50.2837
Offline
Post: #2
RE: loops
Clicked the RED one because its mah favorite color Yay
10/03/2012 07:04 AM
Find all posts by this user Quote this message in a reply
ProperBritish
Daddy Proper
Team DreamArts

Posts: 5,666.3250
Threads: 192
Joined: 19th Nov 2008
Reputation: -2.36574
E-Pigs: 147.7035
Offline
Post: #3
RE: loops
i use for loops much more than while ones, because they're more verbose and make my code easier to understand.
the incrementing element, breaking condition and iterator is all there.

i only use while loops for stuff that isn't an integer increment, like:

Code:
while(!pIfstream.eof())
{
       cout << var << endl;
}


I've only been programming for a year and a half, so my use of looping so far i would say is rather limited compared to more seasoned programmers.


[Image: rsz_contrast.png]

Spoiler for More sigs:
[Image: 6xu74t8]
[Image: sig.php]

[Image: 656embk]
[Image: sig.png]
(This post was last modified: 10/03/2012 07:20 AM by ProperBritish.)
10/03/2012 07:16 AM
Find all posts by this user Quote this message in a reply
whjms
EpiCanadian

Posts: 435.1825
Threads: 126
Joined: 23rd Dec 2008
Reputation: 3.37413
E-Pigs: 24.8045
Offline
Post: #4
RE: loops
It really depends on your situation, though I use for loops more.
10/03/2012 07:36 AM
Find all posts by this user Quote this message in a reply
trademark91
Unique?
Fractal Insanity

Posts: 4,719.9300
Threads: 269
Joined: 4th Jan 2008
Reputation: -6.15982
E-Pigs: 105.8691
Offline
Post: #5
RE: loops
I'm pretty sure they just fit different circumstances. One isn't really better than the other.

In bash, there are 3 kinds of loops: for, while, and until.

[Image: 531115][Image: 76561198014212040.png]
windows Proud
10/03/2012 12:25 PM
Find all posts by this user Quote this message in a reply
Assassinator
...

Posts: 6,646.6190
Threads: 176
Joined: 24th Apr 2007
Reputation: 8.53695
E-Pigs: 140.8363
Offline
Post: #6
RE: loops
(10/03/2012 12:25 PM)trademark91 Wrote:  I'm pretty sure they just fit different circumstances. One isn't really better than the other.

Yeah, which is why I mentioned the convo was pretty retarded.  But a lot of cases you an use both and so it really just comes down to personal preference.

(10/03/2012 12:25 PM)trademark91 Wrote:  In bash, there are 3 kinds of loops: for, while, and until.

Yeah there are other types of loops like a do while loop and stuff, but for and while are the main types of loops pretty much every programming language has.
10/03/2012 06:04 PM
Find all posts by this user Quote this message in a reply
Kuu
Awesome

Posts: 1,112.1322
Threads: 61
Joined: 13th Aug 2008
Reputation: -2.97985
E-Pigs: 33.8125
Offline
Post: #7
RE: loops
I only use while for a timer or counter.

I use For way more often.

So in the spirit of the poll, For Loops are the greatest evar!1!

[Image: B5b0K][Image: FSN6.png]
11/03/2012 03:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA
Smart Alternative

Posts: 17,022.2988
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
Offline
Post: #8
RE: loops
I prefer foreach loops.
11/03/2012 04:12 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ProperBritish
Daddy Proper
Team DreamArts

Posts: 5,666.3250
Threads: 192
Joined: 19th Nov 2008
Reputation: -2.36574
E-Pigs: 147.7035
Offline
Post: #9
RE: loops
(11/03/2012 04:12 AM)ZiNgA BuRgA Wrote:  I prefer foreach loops.

there's always one :]

[Image: rsz_contrast.png]

Spoiler for More sigs:
[Image: 6xu74t8]
[Image: sig.php]

[Image: 656embk]
[Image: sig.png]
11/03/2012 09:39 AM
Find all posts by this user Quote this message in a reply
Silvertie
Older, less cringe, still mad.
Fractal Insanity

Posts: 1,016.3688
Threads: 32
Joined: 9th Jun 2009
Reputation: -5.33618
E-Pigs: 32.7022
Offline
Post: #10
RE: loops
I'm seeing a disgusting amount of votes for silly For loops.

I think For loops are restricted compared to While loops. On the other hand, it's a lot easier to derp up a while loop by forgetting to increase whatever it is that controls the loop.

While Loop master race.

"Books! I've read several on the subject!"
[Image: khadorsigfinal.jpg]
Silvertie: The Blog | A Door In Nowhere: The Webcomic
12/03/2012 05:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: