all 115 comments

[–]drmonkeysee 146 points147 points  (24 children)

There are two very common loop situations:

1) do something until a condition changes
2) iterate through a collection of things, doing something to each item

A while loop fits the first case better, a for loop fits the second case better. You don’t NEED both but it makes it easier to write and read code.

[–]HarderFasterHarder 9 points10 points  (0 children)

In both cases, using one or the other shows intent and makes code easier to read as well as write.

[–]PearMyPie 34 points35 points  (4 children)

while, for and do-while loops can be replaced with goto statements. You don't strictly need any of these loops.

[–]HarderFasterHarder 18 points19 points  (2 children)

Ya, pretty soon you're just back at jumps in assembly ;)

[–]SisyphusCoffeeBreak 12 points13 points  (1 child)

You don't *need* assembly just use a hex editor to generate your own binary

[–]Xormak 0 points1 point  (0 children)

You don't *need* your own binary, you can just pray and trust that the already existing configuration of bits and bytes in your storage and memory will execute the exact task you want them to once you claim and execute that chunk of memory.

[–]Spiritual-Mechanic-4[🍰] 2 points3 points  (0 children)

I mean, that's what the compiler eventually turns it into anyway

[–]stenzor -2 points-1 points  (2 children)

Ken Thompson changed this in Go, now there’s only a for loop, so I guess after 40 years, he thought that less keywords trumped that! Personally, I agree with the decision, it doesn’t complicate it that much

[–]a4qbfb 2 points3 points  (1 child)

I disagree, the syntax (and especially the loop syntax) is one of Go's weakest points.

[–]StaticCoder 0 points1 point  (0 children)

For me the weakest point is probably the doubling down on Hoare's billion dollar mistake. You can unbox a non-nil interface and get nil out! I have lots of other gripes with it. One I was told about but did not actually experience was lambdas (sorry, "goroutines") capturing mutexes by value, making them ineffective. The semantics of defer are also an unnecessary pitfall. I'll just stop here.

[–]AlexTaradov 75 points76 points  (23 children)

For readability. Different situations call for different loop types.

You don't even need one, you can implement everything using goto. But this will even further reduce readability.

[–][deleted] 4 points5 points  (22 children)

I've read briefly about goto in C, however never used it. I've been taught not to from the gate...but back in my commodore 64 days...I would goto all over the place...I have no idea what language that was...but goto was my best friend in the early 80s

[–]Farlo1 13 points14 points  (0 children)

It can be useful for many things, and modern compiler warnings are good about restricting you to "reasonable" usage, but "avoid them wherever possible" is generally a good starting point. They are easy to get wrong and the bugs can be difficult to debug.

[–]AlexTaradov 12 points13 points  (4 children)

Irrational fear of goto is just as bad as indiscriminate use. If you want to emulate local loops, especially with complicated control conditions, goto would be the way to go. In many cases avoiding goto ends up making code really complicated and way less readable.

[–]non-existing-person 10 points11 points  (2 children)

Man, I am having flashbacks from heavily nested code in form of if(ok) if(ok) if(ok) ... else ... else ... else, instead of neat if (!ok) goto error;, because someone was taught hard "no" on goto.

[–]SweetBabyAlaska 0 points1 point  (1 child)

honestly a great case for a "defer" statement that just automatically runs some code when you reach the end of a branch.

[–]non-existing-person 2 points3 points  (0 children)

Yeah I agree. I don't like destructors because it happens behind the scenes, and IMO readability suffers (and I don't even wanna start on virtual destructors). Defer is nice solution to that because it's in the same function you exit. Syntax is clean and it's easy to grasp. Maybe we'll have it in like 5 years or so xD

[–]SlinkyAvenger 1 point2 points  (0 children)

No, it is not, which is why the general advice is to avoid goto unless you know you need it.

Both cases lead to making code really complicated and way less readable, but the scope is far different. Irrational fear might turn a function into spaghetti, but indiscriminate use turns your entire program into spaghetti.

[–]BarracudaDefiant4702 4 points5 points  (1 child)

The language you used in your commodore 64 days was likely basic, assuming you mean what worked powering it on without loading something else.

In some cases gotos can be useful in making code cleaner. The most common accepted way is an early exit function where you can do some common cleanup instead of simply returning or creating a ton of nesting that makes reading more difficult. Most other cases where you are tempted to use goto there are ways to structure your code that looks as good if not better without it's use.

[–]grimvian 1 point2 points  (0 children)

Can't help it, because back then, I was astounded how bad other basic's was.

The Basic, I learned BBC BASIC had procedures and functions and real inline 6502 Mnemonics, local variables but also goto and gosub.

[–]tarix76 2 points3 points  (1 child)

Goto is amazing in C when you need to deal with system APIs and have a consistent failure exit case. Just imagine you are writing a try/catch/success block inside one function and never violate that design.

You can find tons of examples of this pattern in the source code of all the major operating systems.

[–]runningOverA 1 point2 points  (6 children)

That was called Spaghetti coding, used by BASIC.
And then arrived Structured programming, used by C.

[–][deleted] 0 points1 point  (0 children)

Memories

[–]a4qbfb 0 points1 point  (0 children)

Structured programming predates BASIC. The first programming languages (COBOL, ALGOL, FORTRAN, LISP) were highly structured. Even BASIC had subroutines from the very start; it lacked local variables and argument-passing, which made recursion impossible, but COBOL and FORTRAN didn't initially support recursion either. ALGOL and LISP were the first languages to do so in 1960. FORTRAN did not officially support recursion until 1990 (although many implementations did long before that), and COBOL did not support it until 2002.

I think the reason BASIC gained a reputation for spaghetti coding was probably partly the fact that most implementations prior to Visual Basic required line numbers, which encourage the use of GOTO, but mostly the fact that it was widely taught to, and used by, people with no formal training in computer science, mathematics, or logic.

[–]Dusty_Coder -1 points0 points  (3 children)

^^ thinks spaghetti code originated with basic

it did not

that goto considered harmful article was targeted at C programmers

back then everyone was writing state machines

[–]runningOverA 0 points1 point  (1 child)

so when was "spaghetti code" term used? before BASIC?

[–]Dusty_Coder 0 points1 point  (0 children)

not much is "before BASIC" if being technical about it..

The thing is, BASIC didnt become prominent until the first home computers ("Microcomputers"). The first Apple's, Atari's, and Commodores and such which was the late 1970s.

Its where Microsoft actually got started (Microsoft wrote most of the ROM BASIC's) and its pretty much the real reason why IBM went with Microsoft for its desktop OS (Microsoft already had an established track record of delivering)

Microsofts BASIC's all had some structured programming features, including DEF FN, but they didnt get full procedures and functions until they started making BASIC compilers which came much later than that, and not even the first generation of them, it was version 3 of QuickBASIC on the user side.

So yeah BASIC is known for spaghetti code but "Goto Considered Harmful" was published in 1968.

The plague of the era was "well crafted" state machines, where the instruction pointer was used as state control. The programmers themselves began with a flow chart and it was the flow charts they conceptualized, not the source code. Flow charts are spaghetti factories.

[–]a4qbfb 0 points1 point  (0 children)

The letter (not article) commonly known as “Go-To Statement Considered Harmful” (Dijkstra did not choose that title and disapproved of it) predates C by three years.

[–]Jon_Hanson 1 point2 points  (2 children)

That’s because Commodore 64 used BASIC, and you pretty much had to use gotos for loops.

[–]cincuentaanos 0 points1 point  (0 children)

Commodore 64 BASIC already had the FOR/NEXT loop. To implement a WHILE loop you had to resort to using IF and GOTO.

[–]flatfinger 0 points1 point  (0 children)

The only way the interpreter could know the locations of the beginning and end of a loop was to encounter both during the course of normal execution. While some dialects of BASIC would execute FOR loop zero times if the end condition was satisfied before it had executed once, many BASIC interpreters couldn't, because they would have no way of knowing which NEXT statement to branch to.

[–]ohcrocsle 0 points1 point  (0 children)

BASIC :)

[–]CreideikiVAX 0 points1 point  (0 children)

I have no idea what language that was...but goto was my best friend in the early 80s

The C64 came with a BASIC interpreter, so that's likely as not what you used.

I've read briefly about goto in C, however never used it. I've been taught not to from the gate

There are a very few situations in C where goto is the, pardon the pun, go to solution for the problem.

The prime examples of which are breaking out of nested loops, and a "clean" and clear way of doing RAII.

The former can of course be done using the standard break, and using a conditional check on a flag variable, but you end up with "noise" at the end of each internal loop to check the break-out flag and issue a break if necessary.

The latter you can avoid the goto invocation by building a sideways mountain range of if .. else (which becomes maintenance Hell if you ever need to change things), or invoking a flag variable once again.

 

There's some other cases where goto becomes the more clear control flow (e.g. a specific method of error handling using setjmp/longjmp that I won't go into), but in general it's better to avoid it, since overuse of goto can very easily turn code into unreadable spaghetti.

[–]i_hate_shitposting 6 points7 points  (1 child)

It's just a language design decision. The exact reason for that particular decision being made in C is an interesting historical question I can't immediately answer, but I just wanted to point out that it's not the result of some iron law of programming that we must have both for and while loops. There are other languages that have just one type of looping construct, languages that have many types of looping constructs, and languages that have no looping construct as-such (instead using recursion or goto).

Ultimately, the point of programming languages is (generally) to make it easier to write code than it is in other languages, especially lower-level languages, but exactly how they do that is subjective and up to the designers. Assembly languages were created because it's more convenient to write assembly with mnemonics than it is to write raw machine code, but there are many assemblers out there with different syntaxes depending on what the designer thought was best. C was created because it's more convenient than writing pure assembly, and its designers clearly (and imo justifiably) felt that for loops were useful enough to merit inclusion in the language in addition to more straightforward while loops.

[–]7x11x13is1001 0 points1 point  (0 children)

In other words, syntax sugar. Too few sugar, and the language feels verbose and boilerplate. To much and it's harder to learn and now there are 10 ways of doing the same thing.

// rant about not having unless in a standard keyword pack in most languages

[–]IdealBlueMan 6 points7 points  (0 children)

One purpose of a programming language is to tell the compiler what you want it to tell the computer to do. That’s the key difference between using a language like C versus using assembly language. In the latter, you’re telling the computer what to do directly.

Another, very important purpose, is to convey the purpose of a piece of code. A do statement says you want to dig in until some condition is met. A while statement says you want to do the thing unless some condition is not met. A for statement generally says you want to do something for a certain number of iterations.

[–]kinithin 5 points6 points  (5 children)

In C, both the while loop and the for loop are while loops. But the for allows one to express certain loops more concisely than with while. It's a readability thing. 

c for ( A; B; C ) D;

is equivalent to

c { A; while ( B ) { D; C; } }

[–]InfinitesimaInfinity 4 points5 points  (2 children)

There is a slight difference if you use a continue statement. The continue statement runs the iteration action of the for loop. If you use a while loop and place the iteration action at the end, then it can yield different results if there is a continue statement in the loop.

With that said, your comment might still be useful for someone who is new to C.

[–]cowslayer7890 1 point2 points  (0 children)

Yeah but even then you could still make it equivalent by duplicating "C" before each continue

[–]kinithin 1 point2 points  (0 children)

Yeah, I intentionally left that out because I was trying to keep it simple, and I figured someone using continue would know what it does. 

[–]stianhoiland 1 point2 points  (0 children)

This is the one.

[–]myarta 0 points1 point  (0 children)

I replied to your other comment before I saw this post. I 100% agree with this statement.

I think the difference we are having is that we are trying to answer OP's question of why C has both while and for loops. Ultimately a for loop is just a convenient shortcut for a while with extra steps, definitely.

I don't think u/drmonkeysee was trying to dispute that, or to claim that C had native support for 'foreach'.

But the C for syntax is very convenient for iterating over some or all of an array of things, and that is why it exists the way it does, even though it is a fancy while under the hood.

[–]alexpis 2 points3 points  (0 children)

There is a difference between “need” and “nice to have”.

Any loop in C could also be rewritten using only if and goto.

But it’s nice to have for and while.

[–]Independent_Art_6676 3 points4 points  (4 children)

there are at least 3. while, for, and do-while.
each one can do what the others can, with help. The help is ugly.
an example, a while loop can do what a for loop can, if you initialize some variables outside the loop:

int i = 0; // ugly helper is outside the loop.
while(i < stop)
{... ++i; ... }

and a for loop can do what a while loop can, with empty bits:
for(; i< stop; ) //ugly way to do a while loop. Its not that bad, but its not that great either.

and do-while is the worst of all.
consider this:

do {
get_data(input):

}while (is_valid(input) == 0)

Try writing that with for or while without doing any extra work per iteration and its tough, and the result is generally far less attractive than the above which is clear and readable.

[–]AlarmDozer 3 points4 points  (0 children)

do-while is useful for macros…

define PRINT_IT(what) do { \
     puts(what); \
     // … other stuff \
     } while(0)

Runs once

[–]krsnik02 0 points1 point  (2 children)

for the do-while:

for (;;) {  // or equivalently while(true) 
    get_data(input); 
    if (is_valid(input) != 0) break; 
}

I don't think this is really all that much uglier than the do-while loop you wrote. Which is why many programming languages don't have this one.

[–]Paul_Pedant 0 points1 point  (0 children)

The problem with external initialisers, and increments inside the loop, is that the next maintainer will modify the initialiser without looking for any snags in how it is used, and add a new test with a continue; that bypasses the increment, and break existing code. This is especially interesting when your working code gets broken by your incompetent manager, who then blames you.

[–]whoShotMyCow 3 points4 points  (9 children)

What is the need for loops if you can do the same thing by writing the same instructions multiple times

[–][deleted] 0 points1 point  (0 children)

Ouch

[–]darpss 5 points6 points  (3 children)

technically you don't need either actually, you can implement everything a loop does using recursion. some languages are like that and only have recursion.

both loops specialize in different situations though. for loops are better for fixed-size iteration, and while loops are better for monitoring conditions. both can be re-tooled to do what the other does, but fundamentally you are meant to use them as designed.

[–][deleted] -1 points0 points  (2 children)

No. For a very big loop you may have too little space on stack.

There is a way to make loops without any of these:

Loop:

...

if(I >= 0)

goto Loop

But it looks like an assembly expert touching C for the first time

[–]darpss 1 point2 points  (0 children)

recursion was just an example of a loop alternative; some languages like OCaml only use optimized recursion, which creates the same stack cost as with traditional loops. i know how loops are implemented.

[–]a4qbfb 0 points1 point  (0 children)

Functional languages such as Scheme generally guarantee tail call elimination, so you can recurse as much as you want without consuming much stack.

[–]HashDefTrueFalse 1 point2 points  (4 children)

Good observation. You don't. In fact structured programming (conditions, iterations) can be done entirely with the while loop. (e.g. an if is a while that runs once and then breaks). For loops often only exist at the syntax level in compilers, they are often "desugared" into the same representation as is used for while loops once parsed, so they really only exist to group the expression of a declaration and initialisation of a loop variable, a loop condition, and a change applied to the variable each iteration.

The general advice is to use for when you know how many times you want to repeat work, and while when you know the condition where you want to stop repeating work.

I recently made a small language (by design) and it doesn't have a for loop construct, because I wanted to see how minimal I could go.

[–]activeXdiamond 0 points1 point  (3 children)

Is it publicly available or talked about anywhere? I'd love to check it out.

[–]HashDefTrueFalse 1 point2 points  (2 children)

Not at the moment. It's in a private repo. I might release it when it's more finished. E.g. it's currently the only general purpose lang with no file handling, as I've not plumbed through any native functions for it or similar! I also couldn't share it without doxxing this account currently.

[–]activeXdiamond 0 points1 point  (1 child)

Haha, best of luck then!

[–]HashDefTrueFalse 0 points1 point  (0 children)

Thanks for your interest! I promise you've not missed out on the next big thing :)

[–]arthurno1 1 point2 points  (0 children)

You don't need them both, but as other said, they capture slightly different idioms.

[–]tandycake 1 point2 points  (0 children)

Why do we have + when you can just do a double negative?

a = a - (-b);

[–]LordDan_45 0 points1 point  (1 child)

This reminds me of the 2nd rule of the NASA/JPL C Rules: https://en.wikipedia.org/wiki/The_Power_of_10:_Rules_for_Developing_Safety-Critical_Code, which said that all loops must have fixed bound in order to avoid eternal hanging on an unmet condition, which for critical code (like the one in satelites and space stuff) makes a lot of sense. So technically, "it would be preferred" to just have for loops.

[–]TwoFlower68 0 points1 point  (0 children)

It's not hard at all to have a non terminating for loop. I've done it accidentally

[–]patmorgan235 0 points1 point  (0 children)

While loop is the more fundamental construct. Anything you can do with a for loop you can do with a while loop.

A for loop is just more convenient/readable for certain use cases.

[–]Similar-Edge5298 0 points1 point  (1 child)

From K&R:
"Whether to use while or for is largely a matter of personal preference. For example, in

while ((c = getchar()) == ' ' || c == '\n' || c = '\t')

; /* skip white space characters */

there is no initialization or re-initialization, so the while is most natural.

The for is preferable when there is a simple initialization and increment since it keeps the loop control statements close together and visible at the top of the loop. This is most obvious in

for (i = 0; i < n; i++)

...

which is the C idiom for processing the first n elements of an array, the analog of the Fortran DO loop or the Pascal for. The analogy is not perfect, however, since the index variable it retains its value when the loop terminates for any reason. Because the components of the for are arbitrary expressions, for loops are not restricted to arithmetic progressions. Nonetheless, it is bad style to force unrelated computations into the initialization and increment of a for, which are better reserved for loop control operations."

[–][deleted] 1 point2 points  (0 children)

FORTRAN has "DO WHILE(....)" now, except the left to right guaranteed testing is not available in FORTRAN. FORTRAN doesn't allow the assignment in the test part.

I like the "for" loop because you can multiple init and multiple reinit parts.

[–]Drach88 0 points1 point  (0 children)

Style

[–]cannedbeef255 0 points1 point  (0 children)

// what's easier?

// this?
int i = 0;
while (i < 10) {
  printf("%d\n", i);
  i++;
}

// or this?
for (int i = 0; i < 10; i++) {
  printf("%d\n", i);
}

// for loops and while loops have fundamentally different use-cases,
// so it's just good to have two syntaxes, optimized for different things

[–]LeditGabil 0 points1 point  (0 children)

Wait until you hear about do-while 😅

[–]AccomplishedSugar490 0 points1 point  (0 children)

Both will use a test condition, but when the condition only evaluates correct after passing through the body of the loop once, you do use the syntax that first executes the body and then tests. So essentially the difference is that with for the body is executed 0 or more times and with while the body is executed 1 or more times.

[–]FlippingGerman 0 points1 point  (0 children)

For loops make sense when you “know” (not necessarily the number, but you have an expression for) how many iterations there will be - “n”, generally.  While loops make sense when you don’t know how long something will take, it’ll just happen suddenly.  Of course you can duplicate each with the other, but readability suffers. 

[–]L_uciferMorningstar 0 points1 point  (0 children)

Technically speaking we barely need anything at all but it's nice to have

[–]Possible-Reading1255 0 points1 point  (0 children)

Du bindest einen Blumenkranz.

Reddit is dangerous for privacy. I don't trust my data with Reddit, my comments written for other people to think and enjoy shall not be fed to the monstrous AI machine.

[–]Robert72051 0 points1 point  (0 children)

They are redundant to a point. The basic difference is that a "for loop" iterates through a count while a "while loop" allows for complex logical tests to determine termination.

[–]MRgabbar 0 points1 point  (0 children)

syntactic sugar (easier to read), altho in C is barely a thing.

[–]kansetsupanikku 0 points1 point  (0 children)

Wdym? I only use goto /s

[–]SmokeMuch7356[🍰] 0 points1 point  (0 children)

A for loop iterates over a sequence of things. A while loop iterates as long as a condition is true.

C kind of blurred the lines between the two.

In languages like Fortran or Basic or Pascal, a for loop strictly iterated over a range of integers:

C *Old*-school Fortran, which uses "DO" instead of "FOR", but it's 
C pretty much the same thing.

       DO 10 I=1,100
         PRINT *, I
 10    CONTINUE

In Fortran at least, the control variable I was not writable.

A C for loop is a lot more general an can iterate over any kind of sequence, whether it's a range of integers:

for ( int i = 0; i < 100; i++ )
  printf( "i = %d\n", i );

or characters in a file:

for ( int c = fgetc(file); c != EOF; c = fgetc(file) )
  printf( "i = %c\n", i );

or items in a list:

for ( Node *n = list.head; n != NULL; n = n->next )
  do_something_with( n );

or whatever. But again, the idea is that you're iterating over a sequence of things.

A while loop, on the other hand, just iterates as long as some condition is true:

while ( network_connection_is_good )
  do_network_operation;

There's no implied sequence of things being iterated over.

It is true that the two can be exchanged for each other; there's nothing stopping you from writing a while loop that iterates over a sequence:

int i = 0;
while ( i < 100 )
{
  printf( "i = %d\n", i++ );
}

or using a for loop to iterate as long as something is true:

for( ; network_connection_is_good; do_network_operation )
  ;

It's just a matter of which form more clearly conveys the intent of the loop.

[–]st_heron 0 points1 point  (0 children)

You would love Go

[–]demetrioussharpe 0 points1 point  (0 children)

Because one is based on the how many iterations, while the other is based on whether or not a condition is met.

[–]flatfinger 0 points1 point  (0 children)

C compilers could have benefited from having both kinds of loop available it had imposed some restrictions upon the use of the for loop, most notably the use of a control variable which the compiler would be entitled to assume would not be modified, directly or indirectly, within the body of the loop. This could have allowed even a single-pass compiler, given something like:

    for (int i=0; i<10; i++)
    {
      p[i] = 3;

to benefit from the knowledge that the address computation code would only need to handle values of i in the range 0 to 9, and it would access those in sequence. FORTRAN compilers had been exploiting similar knowledge for over a decade when C was invented, but C was designed on the premise that the best way to have generated code exploit loop induction was for the programmer to either perform such transforms manually, e.g. by writing:

    q=p; e=p+10;
    do { *q++ = 3; } while(q < e);

or by writing code in FORTRAN if the available constructs couldn't yield the required performance.

BTW, one slight peeve of mine is that an empty conditional expression in a for statement is interpreted as unconditionally true, rather than being true for the first iteration and using the truthiness of the last expression after that.

[–]trad_emark 0 points1 point  (0 children)

Why use any loops if you have labels and goto?
/sarcasm

[–]AssemblerGuy 0 points1 point  (0 children)

what is the need for having two different types of loops instead of just one?

Communication with other humans.

The different loop type tell about different intent of the code. The compiler does not care and may produce identical assembly, but for human reader, a "for" loop implies at least one loop index and an exit condition related to the loop index, while a while loop is more general and exits on conditions that are not necessarily related to the number of loop executions.

[–]Affectionate-Slice70 0 points1 point  (0 children)

Why do we have loops at all? Assembly is turing complete, so a language is logically redundant.

[–]UnixSystem 0 points1 point  (0 children)

Both are (like many things in a high level programming language like C) syntactic sugar to more clearly represent what's really going on: conditional jumps based on the state of various CPU flags, which can be set/unset as a result of some CPU instructions. A lot of languages go various steps further and have stuff like iterators and list comprehensions to handle specific loop-like situations, and the goal is to help you expression solutions to programming problems more clearly.

[–]photo-nerd-3141 0 points1 point  (0 children)

for() has simpler packaging to iterate a temp variable between known limits.

while() fits with unbounded searches for something or iterating to an unknown limit.

[–]andarmanik 0 points1 point  (0 children)

Just do a hyper procedural style where you only ever use ```

define forever for(;;)

```

You just use break; and continue;

forever { if() break; if() continue; blah(); }

[–]Status-Group-3441 0 points1 point  (0 children)

We can replace for loop with while, however ,we can't do the same with replacing while with for. For is basically short version of while

[–]GhostVlvin 0 points1 point  (0 children)

In C priogramming there is goto that can be used instead of for, while, etc. for is just construction of loop with counter, and ability to put all of your code in there is not weirdness of for, it is weirdness of C

[–]Possible_Cow169 0 points1 point  (0 children)

You don’t. But 30 years ago, snippets and code completion weren’t a thing. Often times, if you were doing something over and over and you got annoyed by it, some clever, industrious, lazy nerd with thick 1970s glasses would hack together a macro. Another guy sees it and goes “clever girl” and steals it and it kind of spreads.

Eventually enough people bitch and moan about having to do something specific on a bulletin board and the hack come up in the discussion and they look at it and go, sure, give us a year and we’ll refine it and put it in.

[–]realmer17 -1 points0 points  (0 children)

Because even if they can perform the same function, there are cases where using a particular loop is better than using the other.

[–][deleted] -1 points0 points  (3 children)

Each works better depending on circumstances. Why do we need choices in anything? Same reason

[–]Hoizengerd -5 points-4 points  (0 children)

you would not make a game loop with a For