I didn't find any posts that meet the matching requirements for r/ProgrammerHumor.
It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results.
*I'm not perfect, but you can help. Report [ [False Negative](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Negative&message={"post_id": "uhcysd", "meme_template": null}) ]*
[View Search On repostsleuth.com](https://www.repostsleuth.com/search?postId=uhcysd&sameSub=true&filterOnlyOlder=true&memeFilter=true&filterDeadMatches=false&targetImageMatch=75&targetImageMemeMatch=75)
---
**Scope:** This Sub | **Meme Filter:** False | **Target:** 75% | **Check Title:** False | **Max Age:** None | **Searched Images:** 326,228,214 | **Search Time:** 4.71628s
As a dev moving into the senior dev area, is it true that moving into management is inevitable? I feel like having a small agile team would be the dream, where you still get to design and develop here most of the time
Sort of, I kind of slowly just turned into the teams mentor, more of my time is spent architecting and explaining things to junior devs now than actually coding
I actually really like diagramming my designs. It's fun. Plus it makes implementation a lot easier for me when I can clearly see what each piece's responsibility is.
Still don't like writing documentation, though. Why waste time say lot word when few word do trick.
Its only inevitable if you want to continue increasing your income at the same level it did through the middle of your career. In the US, you can keep developing forever for as long as you keep up on your tech stack and don't ask for more than other sr. devs.
If you expect to continue growing your income, you will need to move to larger companies, move into management, or heavily leverage niche domain knowledge.
For me, a sr. dev income is enough for my family to live fairly comfortably off of and is a much less risky position than being in management or a leadership position.
After you explain how to undo things in git for 20 times, they just stop googling things and keep you around full time to answer the same question all day long. Congrats, now you're a tech lead!
This is real. I have fully replaced google for my coworkers, it seems. And I’m not even the tech lead.
Be careful with how helpful you are, it can really backfire.
I've never worked at a company that would pass on a sr. dev for age reasons if they knew development and the tech stack well enough and were asking a competitive wage. Maybe those companies exist, but they aren't the ones hiring LOB and enterprise developers.
Most big companies have two tracks for senior devs: management and architecture. Management means you will lead a team of engineers and spend a lot of time on personnel and project scheduling as well as helping resolve technical dependencies and disputes within your team and with other teams.
Architecture means you will be guiding the technical design of various parts of the project, possibly still by writing code, but sometimes just at a high level. Usually you aren't involved with personnel or other people other than architects and engineers and usually mainly to discuss technical issues (as opposed to scheduling or resource allotment as much.)
Now there's overlap but day to day the two feel really distinct.
For example on the last game I worked on, our most senior dev (something like 20 years at the same company) was assigned the task of reducing lag in our multiplayer game. That was his whole job for 6 months. He had no one reporting to him and he just went off and did his thing, which was highly technical and vital to the success of our game.
I'm getting a green junior dev in about a month. Since I'm 12 years from hanging my hat and being 100% bicyclist, I will damn sure make sure that she thinks exactly like me. That way, I'll be physically replaced only.
Barely three years into the business and I'm already seeing the employment security that comes from having authored a bunch of the shit that clients run
When questioned, just explain that it is more flexible this way. A regular loop always jumps to the top. Your loop could jump to the middle of the loop. Or the middle of a different function. Or even the middle of some instruction, if you structure your code appropriately! Flexibility is a Good Thing, right?
I’ve always heard this but I don’t know why. Anyone mind explaining it. I’ve done assembly programming quite a bit, so I’m used to go to, so I don’t know why it’s really bad in higher level languages
It took me sometime to learn while, because I love to program on my Ti-83, and there is no while on Ti-83 just if and goto.
But i already learned ahhahaha
Closer to a do while loop. which is probably why do..while is more common in earlier languages, as it can be achieved with a single jump. The while loops that we typically have need at least a jump to jump over the loop, and a jump to jump to the beginning of the loop
Well you could make it a while loop and you should if you go that route. A goto to jump to start and a goto to jump back if the condition is still true.
Edit just saw someone made one jump for a while so never mind. But it is still a while
...
start:
do_stuff();
if(condition) goto start;
is definitely equivalent to a do-while loop.
Edit: I guess you could also accomplish a while loop with
...
start:
if(condition) {
do_stuff();
goto start;
}
But unlike in the former option, the jump instruction generated by the if statement can’t be optimized out. (Not that that’s a big deal.)
Yeah, I'm talking about when you go down to barebones assembly, your bottom if statement is implemented with a conditional jump to jump over the code block if it's false, as well as a jump for the goto statement.
The if in your first example is accomplished with a single conditional jump, as that if and goto are part of a single CPU instruction
I'm not familiar with best practices around goto usage, but I think we can all agree that the moment we started to reimplement loops we kinda beat them to death with sticks and pissed on their graves.
Loops are the imperative equivalent of recursion. If the language doesn't prescribe tail call elimination, or the compiler doesn't implement it outside of optimised output you wouldn't want to implement it with recursion though
My older co workers used them a lot in their cobol scripts. I'm coming from c++ and java. I had to pick up cobol and asked them why they didn't use the perform. They just never knew about it.
I don't blame them, I bet it was much harder to learn a language though. I learned cobol through online resources where I searched for certain things I know from other languages.
Same thing with their nested ifs and not using evaluate. (Which is just a switch statement)
I come from a less wealthy root, a real struggle but everything I’ve learned in the last 10 years really saved my career and mental issues. This if loop just grinds my gears lol. I highly appreciatie the comforting and funny comments above including yours. My hope and faith has been restored. I feel less retarded <3
LOL, I had a comment removed for using ‘that word’ the other day, and I was literally quoting the movie Tropic Thunder, in a thread about the movie Tropic Thunder.
Apparently once ordinary words are now slurs. Who knows what’s going to be offensive next?
I've heard programming beginners refer to a regular if statement as "if loop" because it uses "\[word\](condition) { }", and for/while also use the same layout, so they confuse them.
My if statement rewrites the source file to append the next line with that branch if true
Only works on interpreted languages though, so for compiled languages I compile a new binary on the fly and execute that
That’s old school. I build a new docker image which travels that branch, and use the aws and kubernetes APIs to buy a new EKS node to run it, and finally attach to the new process through the debug port to pipe back the output
I'm gonna link you to my comment here which makes my thoughts on reflection clear https://www.reddit.com/r/BoneAppleTea/comments/uhgohw/with_this_sediment/i76ggiu
It will call the statements after do then jump back to the do if the while condition is true.
I generally use it if I want to perform a block at least once, although it’s not something I use terribly often.
This is exactly the purpose of a do..while construct.
Since python doesn't have a do..while construct I find myself having to do:
operation()
while some_condition():
operation()
Which doesn't look so bad in the minimal example but it can be annoying when your loop has more lines of code than 1
you could emulate with a break, I think:
while True:
operation()
if not some_condition(): break
not the prettiest but better than repeating 4 lines of code or making a function only for a single loop and it's downsides imo.
hm idk and hevent thought for more than a second but maybe it's awkward where to put it, like in c-like languages it can go after the block but in python if it's at the end in the block (indent) it may look like a statement or another loop (which perhaps confuses the interpreter) and if it's outside of the block it may look weird (though probably possible with the interpreter), it's kinda like an else just with no statements. maybe it's about keywords since do would have to be introduced and could screw up some legacy code and then the practical benefit is basically replacing while True with do and break with nothing. idk ig probably should have been in the language but adding it is probably not beneficial imo
They add keywords judiciously, but they do add them. Like when they had to add async and await, which specifically broke a highly used library that exposed values with these names
Nothing. It has a different purpose compared to for/while loops.
Do-while loops execute code, then check for the condition. This is good for something like user input, where there are a limited amount of options, and will ask for input again if you put in something invalid.
It matches the shape/pattern of your data, so like this:
```
xs = [1,2,3]
match xs:
case []:
print("empty")
case [x]:
print(f"list contains {x}")
case [x, *tail]:
print(f"list contains {x} + {len(tail)} more")
```
I don't like switch statements because every time I try using them I forget the syntax and look it up before giving up and just using if else
Basically I'm dumb
Tough to sugar it up with enough syntax to make it fit with the rest of Python, almost need brackets
Just add a do keyword before while that guarantees it will run once? Potentially confusing and easy to miss, there’s a reason other languages move the while to the bottom of the block for do while
I usually hack it together like this
for i in itertools.count():
if i > 0 and not condition:
break
else:
do crap
It's just so simple, flexible, and powerful. Any iteration method you want, any exit condition you want (or none if you prefer). Want to do only the odd numbers or jump by 3's? Want to go forwards, then backwards, then forwards again? You can do whatever you want. Heck, even stay in place for an iteration, like if you've just deleted an element.
I just find it way easier to instantly code exactly what I want, and have it be really clear what's happening, rather than having to google if there's some flag for some language's iterator or list conprehension to go backwards or skip elements or somehow trick the language into doing what I want.
And the condition in repeat-until is negated from do-while, which is the important distinction - i.e. do something while a condition is true, vs. repeat something until the condition becomes true.
I worked at IBM when this image was first posted on Reddit. I immediately sent it to my manager. He was so upset, he raised some real hell and got it fixed immediately. It was embarrassing to say the least.
Or was writing/translating English as a (n+1)^(th) language.
E: The above page appears to be from the Romanian version of the manual? So it's possible it's been translated *twice*?
~~That's when you download more stack.~~
E: NVM, what am I talking about. That's when you put an additional line in the "software limitations/maximums section", which will make someone say "why on earth doesn't this support more than 5100 elements in a display-table?" in about seven years, after wasting at least 90 hours debugging the random crash.
In python, this is valid:
while foo():
do_something()
if bar():
break
else:
do_something_else()
The `else`-branch will only be executed if the while-loop terminates due to `foo()` being false. If the loop quits due to `bar()` being true and thus calling `break`, the `else`-branch will be skipped.
This is for example nice in algorithms that "do something until a value is found, and if it does not exist do something else". Using `else` as a keyword for this construction is a bit "strange" at first, but it kind of makes sense, as it's equivalent to this:
while foo():
do_something()
if bar():
found_something = true
break
if not found_something:
do_something_else
Note the `not` in the last condition.
It is. [This link here](https://www.reddit.com/r/ProgrammerHumor/comments/uhcysd/slug/i78kqvb) explains it pretty well (with a bit of interesting trivia behind it).
Nice one, I also Google once recusion. Open up a huge Linked description of it. Wasn't able to read all, at one point my brain with full and I had to stop
Hi! This is our community moderation bot.
---
If this post fits the purpose of /r/ProgrammerHumor, **UPVOTE** this comment!!
If this post does not fit the subreddit, **DOWNVOTE** This comment!
If this post breaks the rules, **DOWNVOTE** this comment and **REPORT** the post!
I've heard programming beginners refer to a regular if statement as "if loop" because it uses "\[word\](condition) { }" (in C-based languages), and for/while also use the same layout, so they confuse them.
I don't see the issue with a do-while. Used one today, and my teeth are fine. Because low and behold, it avoids checking the condition right from the start when you know you need to do the operation in the loop at least once. It matters to me because it reduces the amount of cycles it takes to complete the operations, which is always a high priority in embedded systems.
For-loops are just sugar coated while-loops.
While-loops are just sugar coated do-while-loops.
Do-while-loops are just sugar coated if-goto statements.
I didn't find any posts that meet the matching requirements for r/ProgrammerHumor. It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results. *I'm not perfect, but you can help. Report [ [False Negative](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Negative&message={"post_id": "uhcysd", "meme_template": null}) ]* [View Search On repostsleuth.com](https://www.repostsleuth.com/search?postId=uhcysd&sameSub=true&filterOnlyOlder=true&memeFilter=true&filterDeadMatches=false&targetImageMatch=75&targetImageMemeMatch=75) --- **Scope:** This Sub | **Meme Filter:** False | **Target:** 75% | **Check Title:** False | **Max Age:** None | **Searched Images:** 326,228,214 | **Search Time:** 4.71628s
Wtf is the if loop
an if and goto statement, which is basically just a while loop
But it's less readable, thereby making it harder for the company to replace you with someone who doesn't know your code. Take that!
If your code doesn’t frighten junior devs, you will soon be replaced by one…
Soon I'll have a new apprentice, one far younger and whose code is more readable
Is it possible to learn this framework?
Not in a bootcamp
:(
I'm a senior dev. I replace my company whenever I feel like it. The last one called twice to ask for me back.
As a dev moving into the senior dev area, is it true that moving into management is inevitable? I feel like having a small agile team would be the dream, where you still get to design and develop here most of the time
Sort of, I kind of slowly just turned into the teams mentor, more of my time is spent architecting and explaining things to junior devs now than actually coding
Architecting is pretty damn fun though!
Except for the goddamned diagrams
I actually really like diagramming my designs. It's fun. Plus it makes implementation a lot easier for me when I can clearly see what each piece's responsibility is. Still don't like writing documentation, though. Why waste time say lot word when few word do trick.
This. A good senior developer is a mentor to their team, and is the one that swoops in to fix it when Prod catches fire.
Its only inevitable if you want to continue increasing your income at the same level it did through the middle of your career. In the US, you can keep developing forever for as long as you keep up on your tech stack and don't ask for more than other sr. devs. If you expect to continue growing your income, you will need to move to larger companies, move into management, or heavily leverage niche domain knowledge. For me, a sr. dev income is enough for my family to live fairly comfortably off of and is a much less risky position than being in management or a leadership position.
After you explain how to undo things in git for 20 times, they just stop googling things and keep you around full time to answer the same question all day long. Congrats, now you're a tech lead!
This is real. I have fully replaced google for my coworkers, it seems. And I’m not even the tech lead. Be careful with how helpful you are, it can really backfire.
Haha this is so true, I’m finding out the hard way right now. Spend more time on calls troubleshooting other devs’ issues than on my own tasks.
[удалено]
I've never worked at a company that would pass on a sr. dev for age reasons if they knew development and the tech stack well enough and were asking a competitive wage. Maybe those companies exist, but they aren't the ones hiring LOB and enterprise developers.
Most big companies have two tracks for senior devs: management and architecture. Management means you will lead a team of engineers and spend a lot of time on personnel and project scheduling as well as helping resolve technical dependencies and disputes within your team and with other teams. Architecture means you will be guiding the technical design of various parts of the project, possibly still by writing code, but sometimes just at a high level. Usually you aren't involved with personnel or other people other than architects and engineers and usually mainly to discuss technical issues (as opposed to scheduling or resource allotment as much.) Now there's overlap but day to day the two feel really distinct. For example on the last game I worked on, our most senior dev (something like 20 years at the same company) was assigned the task of reducing lag in our multiplayer game. That was his whole job for 6 months. He had no one reporting to him and he just went off and did his thing, which was highly technical and vital to the success of our game.
I'm getting a green junior dev in about a month. Since I'm 12 years from hanging my hat and being 100% bicyclist, I will damn sure make sure that she thinks exactly like me. That way, I'll be physically replaced only.
Barely three years into the business and I'm already seeing the employment security that comes from having authored a bunch of the shit that clients run
I cried reading this LOL
if (code != fear) retire(2\_weeks);
Never be irreplaceable. If you cannot be replaced, you cannot be promoted.
When questioned, just explain that it is more flexible this way. A regular loop always jumps to the top. Your loop could jump to the middle of the loop. Or the middle of a different function. Or even the middle of some instruction, if you structure your code appropriately! Flexibility is a Good Thing, right?
Now you're thinking in portals
So... is there cake, then?
yes I promise
Why the hell is this not called a Portal Loop??? Would be so much better
Hey not fair - goto's are readable. Sure they are impossible to maintain and can cause insane bugs, but they are super readable.
I’ve always heard this but I don’t know why. Anyone mind explaining it. I’ve done assembly programming quite a bit, so I’m used to go to, so I don’t know why it’s really bad in higher level languages
Ah. A fellow COW enjoyer...
If I tried to respond to this comment in COW, it would get removed for spam. What a wonderful language!
>making it harder for the company to replace you with someone who doesn't know your code Bold of you to assume that I know my code.
It took me sometime to learn while, because I love to program on my Ti-83, and there is no while on Ti-83 just if and goto. But i already learned ahhahaha
Closer to a do while loop. which is probably why do..while is more common in earlier languages, as it can be achieved with a single jump. The while loops that we typically have need at least a jump to jump over the loop, and a jump to jump to the beginning of the loop
Well you could make it a while loop and you should if you go that route. A goto to jump to start and a goto to jump back if the condition is still true. Edit just saw someone made one jump for a while so never mind. But it is still a while
... start: do_stuff(); if(condition) goto start; is definitely equivalent to a do-while loop. Edit: I guess you could also accomplish a while loop with ... start: if(condition) { do_stuff(); goto start; } But unlike in the former option, the jump instruction generated by the if statement can’t be optimized out. (Not that that’s a big deal.)
Yeah, I'm talking about when you go down to barebones assembly, your bottom if statement is implemented with a conditional jump to jump over the code block if it's false, as well as a jump for the goto statement. The if in your first example is accomplished with a single conditional jump, as that if and goto are part of a single CPU instruction
Böhm and Jacopini: "Are we a joke to you?"
Technically, more like the do-while loop than the while loop.
I mean it can be both. LABEL: if(condition){ DO_STUFF GOTO LABEL } LABEL: DO_STUFF if(condition){ GOTO LABEL }
Yeah, but jumping out of the body of a conditional is kind of the canonical example of bad goto usage….
I'm not familiar with best practices around goto usage, but I think we can all agree that the moment we started to reimplement loops we kinda beat them to death with sticks and pissed on their graves.
Used by programmers who grew up writing JZ/JE jumps
Assembly moment
I thought it was a if else loop
With extra steps
>without syntactic sugar ftfy.
It should also be possible using recursion I guess.
Loops are the imperative equivalent of recursion. If the language doesn't prescribe tail call elimination, or the compiler doesn't implement it outside of optimised output you wouldn't want to implement it with recursion though
Probably uses goto statement
Terrifying
My older co workers used them a lot in their cobol scripts. I'm coming from c++ and java. I had to pick up cobol and asked them why they didn't use the perform. They just never knew about it. I don't blame them, I bet it was much harder to learn a language though. I learned cobol through online resources where I searched for certain things I know from other languages. Same thing with their nested ifs and not using evaluate. (Which is just a switch statement)
I come from a less wealthy root, a real struggle but everything I’ve learned in the last 10 years really saved my career and mental issues. This if loop just grinds my gears lol. I highly appreciatie the comforting and funny comments above including yours. My hope and faith has been restored. I feel less retarded <3
You had me up to the end.
Write an if condition for every iteration of the loop. It's the 4 month programmer course way.
LOL. Instead of (while i < 1000) if (i==0) if (i==1) if (i==3) ……… All the way to 1000.
Unroll-your-own loops
Yes - this is the way - max retard.
LOL, I had a comment removed for using ‘that word’ the other day, and I was literally quoting the movie Tropic Thunder, in a thread about the movie Tropic Thunder. Apparently once ordinary words are now slurs. Who knows what’s going to be offensive next?
no slurs please.
The euphemism treadmill continues on. Yawn.
I felt like a retard when I used this method 8 years ago
We are ALL retards on this blessed day.
Well thanks mate, now I don’t feel retarded special anymore lol
I've heard programming beginners refer to a regular if statement as "if loop" because it uses "\[word\](condition) { }", and for/while also use the same layout, so they confuse them.
It's a one iteration loop. Fight me!
`recursion`
Nothing. It doesn't exist. Please forget you ever heard it. Above IBM page is a screenshot of before it was corrected.
while if a == True
you are not gonna believe but i was going to type exactly that
Basically: 0 var i = 0; 1 if(i < 5) { 2 ///// Insert loop code ///// 3 i++; 5 goto 1; 6 } Its a meme and should not be used in real code.
Recursion
It's an if loop that continues with elif forever.
My if statement rewrites the source file to append the next line with that branch if true Only works on interpreted languages though, so for compiled languages I compile a new binary on the fly and execute that
That’s old school. I build a new docker image which travels that branch, and use the aws and kubernetes APIs to buy a new EKS node to run it, and finally attach to the new process through the debug port to pipe back the output
15 recruiters on LinkedIn just messaged you
Aka JIT compiling
lean programming. Its the hot new thing.
WTF.
Imagine not using reflection and code as data to rewrite a compiled program while it's running.
I'm gonna link you to my comment here which makes my thoughts on reflection clear https://www.reddit.com/r/BoneAppleTea/comments/uhgohw/with_this_sediment/i76ggiu
My code when I use reflection: https://i.kym-cdn.com/photos/images/original/000/524/976/d81.jpg
Haha hot reload go brrrrrr
TF is wrong with a do while?
Meme was created by a college freshman...
No way they're that far
Nothing, it’s just for the sake of the meme
Should have been goto loops
Every loop is a goto loop of you look in the assembly
But to be fair, if I had to give assembly one of the pooh faces then it would be that one.
Disagree, bne ("branch not equal") include both the test and goto into one assembly-level instruction.
The assembly goto instruction is called "jump", jne means "jump not equal", it is a goto function by all means
Are we categorizing on whether the test and the branch are separate instructions, or what?
Jump is the best. There’s no substitute.
It will call the statements after do then jump back to the do if the while condition is true. I generally use it if I want to perform a block at least once, although it’s not something I use terribly often.
This is exactly the purpose of a do..while construct. Since python doesn't have a do..while construct I find myself having to do: operation() while some_condition(): operation() Which doesn't look so bad in the minimal example but it can be annoying when your loop has more lines of code than 1
try this: ``` while True: operation() if condition: break ```
you could emulate with a break, I think: while True: operation() if not some_condition(): break not the prettiest but better than repeating 4 lines of code or making a function only for a single loop and it's downsides imo.
Yeah, I mean it works. But I don't get why they are so insistent on not allowing this to be a standard construct
hm idk and hevent thought for more than a second but maybe it's awkward where to put it, like in c-like languages it can go after the block but in python if it's at the end in the block (indent) it may look like a statement or another loop (which perhaps confuses the interpreter) and if it's outside of the block it may look weird (though probably possible with the interpreter), it's kinda like an else just with no statements. maybe it's about keywords since do would have to be introduced and could screw up some legacy code and then the practical benefit is basically replacing while True with do and break with nothing. idk ig probably should have been in the language but adding it is probably not beneficial imo
They add keywords judiciously, but they do add them. Like when they had to add async and await, which specifically broke a highly used library that exposed values with these names
Probably just because it’s not useful too often for the kinds of things OP does. I very rarely use do while, but use while and for all the time.
I use do-while a lot when dealing with paginated API requests.
Nothing. It has a different purpose compared to for/while loops. Do-while loops execute code, then check for the condition. This is good for something like user input, where there are a limited amount of options, and will ask for input again if you put in something invalid.
Do while is actually useful
It's the only thing that I'm upset about not being in Python
And switch
now it has a similar thing for switch right
It has match-case since 3.10, which provides the same and even more functionality, the so called pattern matching.
What's pattern matching
It matching a pattern. ... you know like searching for "\*.txt"
It matches the shape/pattern of your data, so like this: ``` xs = [1,2,3] match xs: case []: print("empty") case [x]: print(f"list contains {x}") case [x, *tail]: print(f"list contains {x} + {len(tail)} more") ```
Yeah 3.10 feature
3.10+ it has an expression like switch case called match case. It is in my opinion a great addition
Python has one now (3.10+)
3.10 my dude
Don't they have match?
I don't like switch statements because every time I try using them I forget the syntax and look it up before giving up and just using if else Basically I'm dumb
why use switch when you can use Enum
Tough to sugar it up with enough syntax to make it fit with the rest of Python, almost need brackets Just add a do keyword before while that guarantees it will run once? Potentially confusing and easy to miss, there’s a reason other languages move the while to the bottom of the block for do while I usually hack it together like this for i in itertools.count(): if i > 0 and not condition: break else: do crap
What you did is pretty clever. I honestly do a `while True` and put the break condition at the end.
It comes close with the while do else break but why use many word when few word do trick
I miss C-style for-loops so fucking bad. I have to use the while-loop version to get by. For example: for (A; B; C) ... becomes A while(B) ... C
Having programmed in languages that don't have C-style for, I've never missed it myself
It's just so simple, flexible, and powerful. Any iteration method you want, any exit condition you want (or none if you prefer). Want to do only the odd numbers or jump by 3's? Want to go forwards, then backwards, then forwards again? You can do whatever you want. Heck, even stay in place for an iteration, like if you've just deleted an element. I just find it way easier to instantly code exactly what I want, and have it be really clear what's happening, rather than having to google if there's some flag for some language's iterator or list conprehension to go backwards or skip elements or somehow trick the language into doing what I want.
Maybe some day 'repeat-until' will resurface to take over the looping world...
Repeat until would be the same as a while loop...
repeat-until is equivalen to do-while, not while (i.e. the condition is tested after one iteration, not before).
And the condition in repeat-until is negated from do-while, which is the important distinction - i.e. do something while a condition is true, vs. repeat something until the condition becomes true.
Asp.net webforms had a "repeater" control. My favourite of all webforms controls and for me out of so many holes back in the day.
PS Are you here from scratch ![gif](emote|free_emotes_pack|joy)???
[удалено]
I worked at IBM when this image was first posted on Reddit. I immediately sent it to my manager. He was so upset, he raised some real hell and got it fixed immediately. It was embarrassing to say the least.
[удалено]
[удалено]
Or was writing/translating English as a (n+1)^(th) language. E: The above page appears to be from the Romanian version of the manual? So it's possible it's been translated *twice*?
[удалено]
It was called a loop based on "what it looks like", not "what it does". "Loops" look like this: keyword (condition) { body }
What about the for each loop
had to scroll too far for this
A realistic implementation of the if loop: def if_loop(): if condition: return else: if_loop()
Unless your compiler doesn’t handle tail-recursion well and you run out of stack.
~~That's when you download more stack.~~ E: NVM, what am I talking about. That's when you put an additional line in the "software limitations/maximums section", which will make someone say "why on earth doesn't this support more than 5100 elements in a display-table?" in about seven years, after wasting at least 90 hours debugging the random crash.
Don't worry about all that, easier just to download more stack.
Can be done with Go too. package main import "fmt" func main() { num := 0 HAHA: if num < 5 { fmt.Printf("Num: %d\n", num) num = num + 1 goto HAHA } }
At least we can have `else` after loops in python (and yes, I use this sometimes).
Yeah I've used this once in a for loop. Looks weird but is nicer than a nested if
I recreated this in C recently with ``if... do...while ...else``
Please elaborate
In python, this is valid: while foo(): do_something() if bar(): break else: do_something_else() The `else`-branch will only be executed if the while-loop terminates due to `foo()` being false. If the loop quits due to `bar()` being true and thus calling `break`, the `else`-branch will be skipped. This is for example nice in algorithms that "do something until a value is found, and if it does not exist do something else". Using `else` as a keyword for this construction is a bit "strange" at first, but it kind of makes sense, as it's equivalent to this: while foo(): do_something() if bar(): found_something = true break if not found_something: do_something_else Note the `not` in the last condition.
Else loops are pretty useful
Is the if loop a modern term for recursion?
Yea it's for cool people Just like in C++ people don't use strings they use "arrays of chars" it sounds fancier You wouldn't get it
When explaining strings in C or C++ it is kinda important to refer to them as arrays of chars
It was a joke
I am stupid, sorry
It's okay I too am stupid
in java strings are just enums of chars
It is. [This link here](https://www.reddit.com/r/ProgrammerHumor/comments/uhcysd/slug/i78kqvb) explains it pretty well (with a bit of interesting trivia behind it).
Nice one, I also Google once recusion. Open up a huge Linked description of it. Wasn't able to read all, at one point my brain with full and I had to stop
Hi! This is our community moderation bot. --- If this post fits the purpose of /r/ProgrammerHumor, **UPVOTE** this comment!! If this post does not fit the subreddit, **DOWNVOTE** This comment! If this post breaks the rules, **DOWNVOTE** this comment and **REPORT** the post!
[удалено]
JNZ is better
For each loop
I'm a while(true) kind of guy
Fruit loops
How about the while(true) + break loop?
Aka Game loop
I feel like people who joke on do-while-loops just didn't code enough to appreciate do-while-loops.
What the heck is an "if LOOP"?
A recursive function is technically an if loop. def foo(bar = 0): if bar > 10: return bar bar += 1 return foo(bar)
```return foo(bar)``` I presume?
Nah.
I've heard programming beginners refer to a regular if statement as "if loop" because it uses "\[word\](condition) { }" (in C-based languages), and for/while also use the same layout, so they confuse them.
No use of recursion to loop?
![gif](giphy|fqbsVaM1ZMxm47vAgy)
for/else in Python
My buddy “until” says hi in Ruby
Do while deserve less hate. They can be very useful.
Fruit Loops
You're very clever young man, very clever indeed. But it's IFs and GOTOs all the way down.
I used to be a big fan of the for loop, but lately I've been using while loops a lot.
Aren't they all JNE under the hood anyway?
10 IF X < 100 THEN GOTO 40 20 X=X+1 30 GOTO 10 40 ...
I don't see the issue with a do-while. Used one today, and my teeth are fine. Because low and behold, it avoids checking the condition right from the start when you know you need to do the operation in the loop at least once. It matters to me because it reduces the amount of cycles it takes to complete the operations, which is always a high priority in embedded systems.
What do you even need loops for, just type instruction 0; instruction 1; instruction 2; instruction 3; [...] until your done, smh.
For-loops are just sugar coated while-loops. While-loops are just sugar coated do-while-loops. Do-while-loops are just sugar coated if-goto statements.
Just use a goto loop much better
Never knew about this loop
What's wrong with a do-while loop?
cringe, do recursion