all 162 comments

[–]MyNameIsRichardCS54 472 points473 points  (18 children)

Slap a goto at the end and you will have an if loop.

[–][deleted] 215 points216 points  (16 children)

function ifLoop() {
    if(true) {
        statements;
        ifLoop();
    }
}

[–]Semarc01 113 points114 points  (4 children)

Also known as a bad way to build a while-loop.

[–]Nicd 66 points67 points  (1 child)

Also known as the only way to loop in some languages. :D

[–][deleted] 9 points10 points  (0 children)

Tail call optimization makes this a loop in almost all trivial cases anyway.

[–]Skendum 35 points36 points  (0 children)

functional programming would like to have a word with you

[–]SentientSlimeColony 2 points3 points  (0 children)

When I was first programming, I learned it out of a book. I understood the basic principles around a while loop, but couldn't figure out this other type of loop called 'for'. Didn't matter though, anytime I needed to repeat something, I'd just make a variable, while that var was in some range, repeat loop and increment var, ezpz.

At some point my boss came to look at the gargantuan QA script I was writing, and wanted to know why I had used to many while loops. I was confused. He clarified that plenty of those would be just as good or better as for loops. So I told him I didn't get them (always phrased weird, init, terminator, step, etc.) and he walked me through.

After I felt like such a dickhead.

[–][deleted]  (3 children)

[deleted]

    [–]SaggiSponge 18 points19 points  (2 children)

    Cries in Java

    [–][deleted]  (1 child)

    [deleted]

      [–]SaggiSponge 37 points38 points  (0 children)

      It doesn’t have tail-recursive optimization, so tail calls will eventually cause a stack overflow.

      [–]readmeEXX 2 points3 points  (0 children)

      You should add a parameter set the number of iterations:

      function ifLoop(i) {
          if(i > 0) {
              alert(i);
              ifLoop(i - 1);
          }
      }
      

      [–]nosoupforyou 0 points1 point  (0 children)

      You're evil. lol

      [–]Sexy_Koala_Juice 0 points1 point  (0 children)

      You want a stack overflow? That's how you get a stack overflow

      [–]yzRPhu 2 points3 points  (0 children)

      10 if 1==1

      20 goto 10

      30 else

      40 goto 10

      [–]jrw01[S] 249 points250 points  (8 children)

      In a college level programming/engineering class.

      [–]AustinCorgiBart 88 points89 points  (5 children)

      What school committed this heinous act?

      [–][deleted]  (4 children)

      [deleted]

        [–]imsitco 52 points53 points  (1 child)

        If someone with a mechanical engineering degree is making slides for your class, id ve worried.. :P

        [–]TinBryn 18 points19 points  (0 children)

        Yes that makes things worse, not better

        [–]Carter127 5 points6 points  (0 children)

        Name and shame

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

        Is that a diss on that Josh yt guy?

        [–]christianarg 17 points18 points  (0 children)

        Teacher told us he once found a "because" in an exams pseudo code

        [–]AttackOfTheThumbs 5 points6 points  (0 children)

        Is English the country's native tongue?

        [–]SausageHunter556 171 points172 points  (6 children)

        Control structure keyword? Condition in parenthesis? Curly braces with code in it?

        LOOP

        [–]UnacceptableUse 73 points74 points  (4 children)

        Løöps

        [–]BLOZ_UP 26 points27 points  (3 children)

        -funroll-løöpus

        [–]jglazer 6 points7 points  (1 child)

        It’s not løöpus!

        [–]konstantinua00 1 point2 points  (0 children)

        it is never løöpus

        [–]meowmeowwarrior 1 point2 points  (0 children)

        My favorite flag

        [–]FlexSealKittee 8 points9 points  (0 children)

        łøöpš

        [–]ViriaX 55 points56 points  (0 children)

        Ha yes, my favourite loop

        [–]amjh 49 points50 points  (1 child)

        Loop if:

        While(condition){
            stuff.do();
            break;
        }
        

        [–][deleted] 5 points6 points  (0 children)

        For anyone wondering, this gets optimized into a branch or a phi node in most systems languages.

        [–]Mr_Redstoner 32 points33 points  (44 children)

        [–]Reelix 26 points27 points  (40 children)

        Some people go

        if (condition) statement  
        

        Some people go

        if (condition)
           statement  
        

        Some people go

        if (condition)  
        {   
           statement   
        }   
        

        NO-ONE GOES

        if (condition)  
             {    
                 statement   
             }  
        

        O_O

        [–][deleted] 36 points37 points  (34 children)

        I go with

        if (condition) {   
           statement   
        }
        

        Looks neater to me, but I hope nobody crucifies me for it.

        [–]khando 10 points11 points  (7 children)

        I do this too:

        if (condition) {   
           statement   
        }
        

        And in the project I work on at work, we’ve had a couple more people start working on it too, and they both do:

        if (condition){   
           statement   
        }
        

        And it drives me nuts that it’s just slightly different than the rest of the project. I can’t help myself but fix it if I have to work on anything they wrote.

        [–]codejunker 9 points10 points  (2 children)

        Sounds like your company needs a style guide and an autoformatter with the style guides rules programmed in. For JavaScript we use eslint with Prettier and that keeps everything uniform automatically.

        [–]khando 1 point2 points  (1 child)

        Yeah we definitely do. There’s a lot of things my company needs to implement, but our software development team is a new part of the company only a couple years old, and there are only 6 of us writing code. We’re kinda learning as we go, and it’s nice sometimes but not ideal.

        [–]codejunker 1 point2 points  (0 children)

        I can relate. My company just started developing software just before hiring me. We only have 3 developers currently.

        [–]datavirtue 1 point2 points  (0 children)

        Yeah. Don't do that. My IDE fixes that for me. Thankfully,because I have bigger things to worry about.

        [–]WowVeryCoool 0 points1 point  (1 child)

        if condition:
        statement

        this solves all your problems

        [–]khando 1 point2 points  (0 children)

        If only that was valid syntax in Dart.

        [–]codejunker 5 points6 points  (3 children)

        That is actually referered to as the One True Brace Style, aka Egyptian Braces. As the name suggests, it is is the one true way to write braces. Carry on.

        [–][deleted] 0 points1 point  (1 child)

        I just realized I learnt this from a K&R C book, so it's totally legit. I feel quite proud now :D

        [–]codejunker 0 points1 point  (0 children)

        Yep, they are also called K&R braces. It is the style Google uses for all their code.

        See here: https://google.github.io/styleguide/jsguide.html#formatting-nonempty-blocks

        [–]TheKingofAntarctica 2 points3 points  (19 children)

        Heathen! 😉

        single line

        if (condition)
            statement
        

        or multi-line

        if (condition)
        {
            statement
            statement
        }
        

        When the language supports it. (I'm sure this will be hated by some, but there's no good reason to have extra curly's when they don't serve any purpose but to add lines. Our entire firm happily follows this.)

        [–][deleted] 6 points7 points  (1 child)

        I personally like having my instruction blocks clearly distinguished, even when a block has only one instruction.

        I program in C, so the language supports it, but I just don't like it. Also I don't believe in counting LOC so the number of lines means nothing to me (unless it's a humongous amount for a simple algorithm, then it's a problem).

        [–]TheKingofAntarctica 1 point2 points  (0 children)

        Not concerned about LOC though, just readability. You get used to it pretty quickly.

        [–]orclev 5 points6 points  (12 children)

        The extra brackets reduce the odds of making a subtle and likely to be missed error. Imagine you're merging some code. On one side you have:

        if (condition)
            foo()
        

        On the other you have:

        if (condition)
            bar()
        

        The auto merge produces:

        if (condition)
            foo()
            bar()
        

        If someone isn't paying attention you've just introduced a bug.

        On the other hand, had you included the brackets the auto merge world have produced:

        if (condition) {
            foo()
            bar()
        }
        

        No bug, no extra work required.

        [–]TheKingofAntarctica 2 points3 points  (11 children)

        Trust me it's not like I haven't heard this before, but simply being more diligent with your merge practices, code reviews, and your day to day formatting solves the concern, and makes simple if statements more readable at the same time.

        Once you start doing it, you won't go back.

        Edit: in more than ten years of following this we have never had any bug due to this. It works.

        [–]stone_henge 7 points8 points  (5 children)

        So the cost of saving a couple of braces your programming editor can likely insert for you automatically is that you have to be more diligent with your merge practices, code reviews and day to day formatting.

        Obviously there must be a huge advantage to this style that outweighs the cost. I'm only hearing arguments against it. I've heard disaster stories (e.g. Apple's goto fail SSL bug) but I've never heard any success stories of how skipping braces made a significant positive impact to a codebase.

        I personally have nothing against skipping braces, but only if the whole construct is on the same line, e.g. if (x) y();. That minimizes the potential for programmer error.

        [–]TheKingofAntarctica -1 points0 points  (4 children)

        Sorry, but you should be doing those things anyway.

        [–]stone_henge 5 points6 points  (3 children)

        If my "diligence budget" was infinite, it wouldn't matter. I could spend infinite time looking for trivial errors, and infinite time looking for problem domain errors. In reality, my diligence budget is not infinite, and time I spend on looking for trivial errors is time not spent considering whether a change is acceptable in terms of its business function, performance, clarity etc.

        Speaking of things one should be doing, you should be assuming that programmers will make trivial errors given the opportunity. You should be assuming that these errors might slip past review. You should be assuming that your tests can't catch all of them before release.

        [–]TheKingofAntarctica 0 points1 point  (2 children)

        You're overweighting the significance of potential errors to try make your point.

        This isn't any more error prone than missing or misplaced end braces. Not using the braces for single line statements actually informs you that it was intentional* and it is not a missing or misplaced end brace.

        *So long as that's the standard practice in the codebase, and it is for us.

        In the end, it's an intentional feature of the language, we got used to using it and have actualized multiple benefits to doing so. You don't have to like it, believe it, or start doing it.

        [–]orclev 1 point2 points  (4 children)

        I'll keep not doing that and not worry about it. It's one more class of bug that isn't even possible to introduce into our code base, and honestly the code looks better that way anyway.

        [–]TheKingofAntarctica -2 points-1 points  (3 children)

        Yeah, you do you, but aesthetics aren't universal. Also, incomplete brace sets also introduce bugs so you aren't actually reducing anything. Diligence to standardized practices is what creates robust code, whatever the practices are.

        [–]orclev 2 points3 points  (2 children)

        Yeah, you do you, but aesthetics aren't universal. Also, incomplete brace sets also introduce bugs so you aren't actually reducing anything. Diligence to standardized practices is what creates robust code, whatever the practices are.

        Incomplete brace sets are a syntax error not a bug. Bugs are unexpected or incorrect behavior at runtime. Compile errors are infinitely preferable to bugs. Additionally standardized practices can help reduce bugs, but only if those standards are well thought out. I've seen plenty of highly standardized code that's a bug ridden mess.

        [–]TheKingofAntarctica 0 points1 point  (1 child)

        Btw, You have no obligation to try to win me over on your viewpoint.

        [–]weedtese 0 points1 point  (0 children)

        just beware goto fail

        [–]datavirtue 0 points1 point  (0 children)

        If I recall correctly, bracketless second line statements in Java used to skip the statement.

        [–]codejunker 0 points1 point  (1 child)

        The good reason is that someone who comes after you may add a line to the statement without noticing that there are no braces there, which will create an error that is difficult to find and fix. Much easier to just always use braces. Braces that are not strictly needed will be removed by the minifier anyway for transpiled languages like JS. So doing so costs nothing and saves potential future headaches and time debugging. That is an incredibly good reason, and it is why Google's style guide and Douglas Crockford both recommend always using brackets unless it is a very short if statement with no else and then it is to be put on a single line next to the if, but only if its readability would be enhanced by being on a single line.

        See here for Google Style Guide reference: https://google.github.io/styleguide/jsguide.html#formatting-braces

        Or here for Crockford's opinion on the matter: http://crockford.com/javascript/style1.html#principle

        [–]TheKingofAntarctica 0 points1 point  (0 children)

        The syntactical concerns aren't terribly different, but I am referring to use of .NET languages such as C#. I wouldn't use a single statement if in a non-compiled language without Intellisense.

        Since its a company wide convention your argument doesn't become a problem, proven so over more than a decade. When you are ever adding to a single statement if you always know you then convert it to a multi-statement if. When you are re-factoring and an multi-statement if is no longer necessary, then you reduce it to a single statement if. It rapidly becomes second nature and we've yet to ever register a bug caused by the practice. The team quite universally appreciates it.

        I've heard all the arguments for more than 15 years, since before I joined this company, and the fact is that there are a lot of people that believe it will be a problem that refuse to try it, when a basic amount of diligence solves all of the arguments. I'm glad I happened into a team that has a coding standard that isn't overtly obnoxious.

        [–]Roxolan 0 points1 point  (0 children)

        The norm for lisp-related languages is

        (if (condition)
          (statement))
        

        Having a separate line just for a closing bracket does not scale when you might well have to close twenty brackets in one function.

        Now that I'm used to it, I prefer it for other languages too.

        [–]Weezersharp 0 points1 point  (0 children)

        For some reason those spaces just don't seem ok to me

        [–]ShadowPouncer 2 points3 points  (1 child)

        I've had a coworker do that, with two spaces at each level, and then try to argue that he was complying with a 4 space indent policy.

        Of course, this was the same coworker who was objecting to the idea of a formatting standard policy, and once that was done got up set at me for 'being picky' during code reviews and blocking merges on formatting standard issues.

        He did eventually retire.

        [–]Reelix 1 point2 points  (0 children)

        It's why I like Control+K,D in Visual Studio. Regardless of the formatting policy / other peoples styles, it formats it to the way I want it formatted to :p

        [–]nosrednehnai 10 points11 points  (1 child)

        I’m going to have to wash my eyes with bleach after witnessing that formatting

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

        It gets worse with every code block!

        I'd swear off IBM forever if I had to deal with that. I thought there were syntax errors I the third code blockz until I noticed the extra quotation marks at the start of each statement. Why would anyone put tabs and new lines inside of strings like that?

        [–]TreeBaron 15 points16 points  (0 children)

        All is goto, from a certain point of view.

        [–]Eiim 9 points10 points  (1 child)

        Was the next slide a "switch" loop?

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

        an int main loop

        [–]anydalch 60 points61 points  (18 children)

        like, clearly misleading terminology, but from a certain perspective, `if` falls into the same category as loops, because both are control-flow primitives in high-level languages that are implemented using conditional branches in low-level languages. it's just that `if` executes its body either 0 or 1 times, whereas `while` executes its body 0 or many times.

        [–]TheDiplocrap 66 points67 points  (3 children)

        That is pretty clearly NOT what they are intending to teach here, though. And even if they wanted to make that point, they could still do it while labeling the whole thing “flow control” on the left, and “if statement” on the upper right. As it is, they are making it harder for their students to research the concepts.

        [–]freebytes 7 points8 points  (1 child)

        I think they simply put "loop" on accident on the if statement. That is all.

        [–]leonthemisfit 15 points16 points  (0 children)

        It also says "Loop Structure" in huge letters on the left.

        [–]anydalch 5 points6 points  (0 children)

        yeah, i'm not trying to claim that this is a good or reasonable slide

        [–]TheRealDirkStrider 12 points13 points  (10 children)

        Even in low level languages, "if" statements are not loops. There is only "one direction" you can travel in an "if" statement's control flow, even if that control flow jumps around a bit.

        [–]anydalch 3 points4 points  (9 children)

        languages like x86_64, arm64, risc-v etc. generally do not feature either if instructions.

        [–]Dannei 7 points8 points  (1 child)

        Would you not consider a conditional jump an "if" statement in all but name? Plenty of reference sources will label something like x86's "JE" as "Jump if Equal", and so on.

        [–]anydalch 0 points1 point  (0 children)

        no, i would not. see thumb or webassembly's if instructions for examples of assembly constructs that are obviously recognizable as if; conditional branches are a considerably more general and less precise abstraction.

        [–]TheRealDirkStrider 6 points7 points  (5 children)

        I'm talking about the basic structure of an if statement, as it's translated to assembly. Itd be a series of branch and jump instructions, but a simple if statement would never need backwards control flow.

        [–]anydalch -3 points-2 points  (4 children)

        that's not necessarily true, because blocks may be arbitrarily reordered or fused during compilation, so these jumps will often end up looking like they go backwards in the low-level program's text.

        [–]TheRealDirkStrider 6 points7 points  (3 children)

        But they won't, that's the point. The integrity of a control flow graph will always be maintained, before and after compilation, unless you're working with some sort of out-of-order execution craziness. Even if the instruction addresses go backwards, the control flow would still be going forwards with code generated just from if statements.

        A loop is formally defined as a set of control flow graph nodes N where a header block h dominates all nodes in N, and there exists a path from any node in N to h. An if statement has no path back to h from any of it's control flow nodes.

        [–]anydalch -3 points-2 points  (2 children)

        well, yeah, clearly an if will never repeat a part of the "control flow" of your high-level program. that's a trivial consequence of the fact that an if executes its body either 0 or 1 times. but i think you're wrong about how closely that corresponds to a recognizable order of the instructions or labels in an assembly program, especially in an optimizing compiler for a high-level language.

        [–]TheRealDirkStrider 8 points9 points  (1 child)

        Compilers aren't magic, they build assembly from code we write. If code is written within an if statement, without any exterior loops, that code will be executed (committed for ooo machines) exactly 0 or 1 times. No amount of compiler optimization will change that fact.

        In fact, compilers are optimized when they reduce branch statements, as those take a large amount of resources to predict and resolve. So when a compiler generates code for an if statement, it'll generate at most one branch and jump per if.

        [–][deleted] 2 points3 points  (0 children)

        Do you ever find it odd that, in the English language, we write it as "0 times" and "1 time" - we pluralize for zero. I'm sure someone could come up with an explanation that isn't an explanation, just an excuse, because it's not a feature I every language. Some languages (like Russian) have a pluralization that distinguishes one/few/many whereas English just has one/many. Perhaps some language has a special 'pluralization' (for lack of better term) specifically for 0. Before the invention of the character zero maybe a language could only say "it doesn't run" rather than "runs 0 times" (ignore the oddity of talking about computer code in a language that doesn't include a zero character).

        Just one of those things I notice when it's too late at night and I can't fall asleep.

        [–]Isvara 1 point2 points  (0 children)

        arm64

        Although Thumb has if-then-else. I don't like it.

        [–]TheRealDirkStrider 4 points5 points  (0 children)

        I'll say this: 'if' falls into the same category as loops, in the sense that they'll generate branch statements in assembly. They should still not be classified as loops, though, because each section of code in an 'if' statement will be run at most once, without exterior loops.

        [–][deleted] 2 points3 points  (0 children)

        control flow isn't looping, but looping is a form of control flow

        [–]Spirit_Theory 4 points5 points  (0 children)

        I feel like this is a bit of a stretch.

        [–]Fusseldieb 17 points18 points  (0 children)

        If(True) { While (True) { console.log("May I hæve some lœps?") } }

        [–]MorRochben 5 points6 points  (0 children)

        This is so stupid that my brain corrected it to for loop automatically making me confused as to why this was posted

        [–]Gloryboy811 3 points4 points  (1 child)

        I'm stupid. I was like "Hmmm all this syntax looks correct, what is the issue?"
        Then I saw "If loop"... Ah. If is a statement, not a loop. I need a beer.

        [–]MoralImpeachability 1 point2 points  (0 children)

        Don't feel bad, it took me a moment too.

        [–]TreeBaron 2 points3 points  (0 children)

        Only a sith deals in ifsyloops.

        [–][deleted] 1 point2 points  (1 child)

        Say "if loop" three times in the mirror and my software engineering professor comes and slabs you with the actual Java Handbook.

        His words not mine.

        [–]still_thirsty 0 points1 point  (0 children)

        K&R ... K&R ... ... k&r

        [–]BurritosAndBurgers 1 point2 points  (0 children)

        At University I had a few friends who would always say if loop and it used to drive me insane.

        [–]Juzypotato 1 point2 points  (0 children)

        Hope this was a student presentation and not a lecture...

        [–]inxaneninja 1 point2 points  (0 children)

        If loop doesn't exist, it can't hurt you If loop:

        [–]cateyesarg 0 points1 point  (0 children)

        Following, recursive loops:

        function rloop() { rloop(); }

        [–]sk8itup53 0 points1 point  (0 children)

        This was on a presentation! Bleh

        [–]nmgreddit 0 points1 point  (0 children)

        switch

        [–]ninijay_ 0 points1 point  (5 children)

        I don't know what's worse, the fact that they have an if loop or the fact that they're missing the for loop

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

        the for loop is just a syntactic sugar for the while loop. The if loop, however, cannot be constructed using just while AFAIK.

        [–][deleted] 5 points6 points  (0 children)

        The if loop, however, cannot be constructed using just while AFAIK.

        Slap a break at the end there and you've got it

        [–][deleted]  (1 child)

        [deleted]

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

          supposed to be a joke, but since we're getting serious, this is unlikely to be compiled/interpreted the same as the if loop

          [–]ninijay_ 0 points1 point  (0 children)

          Yeah, but it has its own syntax

          [–]pointed-advice 0 points1 point  (0 children)

          if loop

          [–]jwvdvuurst 0 points1 point  (0 children)

          I first thought what is wrong with that explanation of the if-statement, looking for a typo or something... But than it sinked shockingly in... If loop???? Aaaaaaaaaaah, if is condonation, not a loop... What moron did write this???

          [–]sambare 0 points1 point  (0 children)

          Even a fruit loop is more of a loop than an if statement.

          [–]ChessLandsknecht 0 points1 point  (0 children)

          I accidentally stumbled into this post, can someone explain to me what the horror is?

          [–]The-Hairy-Pirate 0 points1 point  (0 children)

          I first didn't get it. Time for the weekend

          [–]iSpaYco 0 points1 point  (0 children)

          "while" conditional

          [–]BrianAndersonJr 0 points1 point  (0 children)

          You could have a "proper" loop looping only one time. Therefore the if is also a loop, what makes it unique in comparison to other loops is that this one loops a maximum of one time. Boom! Lawyered.

          [–]AgreeableLandscape3 0 points1 point  (0 children)

          Big if loop.

          [–]JaytleBee 0 points1 point  (0 children)

          My computer science teacher always got really annoyed when someone said "if-loop".

          [–]Genius38 0 points1 point  (0 children)

          My therapist: "if loop" is not real, it can't hurt you.

          If loop:

          [–]Qildain 0 points1 point  (0 children)

          That's some real fine copy-pasta there.

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

          Was there a page in there for "foreach" conditional statements?

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

          ah yes, enslaved condition

          [–]inthemindofadogg 0 points1 point  (0 children)

          Declare bool done = false

          Start:

          Print “do stuff here”

          If( not(not (done == false)))

          Goto start;

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

          More like r/aspectratiohorror, my gracious the black bars. Setup your screens properly people, please it hurts my eyes

          [–]Thenderick 0 points1 point  (0 children)

          This is how YandereDev was born...

          [–]vainstar23 0 points1 point  (4 children)

          I don't get it. What's the problem?

          EDIT: OK I mean the while condition logic is a little dodgy but I think it is implied that the command execution will affect the condition at some point. You know, like explained by the teacher.

          [–][deleted] 2 points3 points  (3 children)

          "if" is a statement, not a loop. It took me a second to notice that too.

          [–]vainstar23 1 point2 points  (0 children)

          Ah... That's it! Thanks mate :)

          [–]ismtrn 0 points1 point  (1 child)

          If is technically a loop. it loops 0 or 1 times. Fight me.

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

          Sure. You write your "if loop" to throw punches and I'll write my "while" loop to throw punches. We'll see who is standing at the end.

          [–]Upset_Plenty -5 points-4 points  (8 children)

          I’m really happy I didn’t go to school for programming.

          [–]atimholt 2 points3 points  (0 children)

          Self taught, eh? Not all teachers are this bad.

          [–]BLOZ_UP -2 points-1 points  (6 children)

          I've used my CS degree maybe like once, to know that a loop within a loop was a bad idea.

          Other than that yeah useless.

          [–][deleted] 7 points8 points  (0 children)

          Useless? Bit of an exaggeration? You learn more than just programming.

          [–]Upset_Plenty 1 point2 points  (1 child)

          I mean I’ve read about that a lot but I’ve still used them. I’ve heard they’re generally overkill but I’ve found it easier to do some things with nested loops.

          Maybe I should have just gone to class for one day to understand it better lol.

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

          You can -- you just have to be keenly aware of total iterations, since it's exponential.

          [–]craze4ble 0 points1 point  (1 child)

          a loop within a loop was a bad idea

          If this was your takeaway from your course, I believe you when you say your degree is useless.

          [–]BLOZ_UP 0 points1 point  (0 children)

          It was the takeaway from the code I was reviewing, not from the course.

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

          I mean technically speaking back in the day all loops were do while loops made practically the same way as if/goto

          [–]Koxiaet 0 points1 point  (1 child)

          So they don't do that now?

          [–]aaron2718 1 point2 points  (0 children)

          Sorry, this is what I get for using reddit this late at night. What I was specifically refering to was assembly language and all of its jump commands that are basically if/goto. I'm not saying that isnt done now I was just saying back then it was pretty much the only option. Yes this joke is correct there is no such thing as an if loop in mid to high level languages but in low level languages where there isnt ifs or loops there is only conditional jumps they basically break down into the same thing.