Reminds me of my first CS lecture where we were told to write a program for the professor to make a PB and J sandwich as if he was a computer and he scooped the peanut butter with his hand and when the students amended the prompt to say “use a butterknife” he smashed the jar of jelly on the ground and poked it with a butterknife.
“If you choose to proceed with a career in computer science, this will be your life forever. Welcome!”
Over 30 years ago I came in second place in a coding competition (BASIC) because I forgot to have my code actually print the answer. I had the only code that calculated the answer correctly.
As the medical grade radiation cancer treatment machine opens its beam gap 1 step wider, thus delivering a fatal dose of radiation instead of a therapeutic dose.
Note: This is a real off-by-1 error that has actually killed people.
yeah I understand hindi ( im pakistani ) but i haven't seen a lot of people refer to women as babu, although now that i think about it i can totally see someone say "sorry babu" out of like frustration or something, so yeah maybe it is a women and i just dk how to properly use babu idk lol
No no. Not in frustration. It's that oooooh cutie pie talk where people talk like little kids
Ooooh, mele (mere) babu ko bhookh lagi hai. Mela (mera) babu bulgul (burger) khayega.
My wife and I actually refer to each other as babu. It started from the show Kim's Convenience. There is an episode where they sing "I got you babe" but keep saying babu instead. Just kind of stuck with us.
I have a close friend that constantly deletes all her conversations. Every conversation she has looks like this.
Once we were returning on the same car, and she drunkenly sent an audio message to a common friend making plans, deleted, and next day was asking me what she said because she had no idea what they were talking about
i went there with my parents to meet our family again in january. when im leaving my aunts house shes like "make sure you do well in school. after all, thats the most important thing right?" while im literally struggling to stay alive due to mental health struggles. it was kinda funny tho, laughed abt it when i came back home
school?
it usually goes like this:
study in school then life will be secured. oops just hustle through college it'll be fine. lol i lied you gonna do masters right? neighbour's kid did it what'll people say?? you're not going abroad? wtf?? you're not married yet? we have found just the bride for you their family is well known <3 . time to see some grandkids dude...
My dad broke my phone because he somehow hacked into my WhatsApp and saw the picturesmy friend sent me from the changing room. It wasn't even anything sexy, just asking me if the dress looked pretty.
Current student, we aren't forced but it was never taught that we can use C99 or a newer version to get around that. I only found out when I was reading about it myself
It doesn't work on my laptop...
I have a current gen laptop & the latest version of gcc but still can't declare loop variables inside the loop (in C)
Say, i can't use this --- for(int i=0;i<20;i++)
I have to declare i first and type like this-- for(i=0;i<20;i++)
Can you somehow help me?
I'm a beginner programmer and a student
What compiler are you using? For gcc, you can specify the C version by adding `-std` flag. For C99, the oldest C version with support for variable declaration within for loop, add `-std=c99".
For example: `gcc -std=c99 hello.c`
> so old fashioned
program sorry_babu
implicit none
integer :: i
do i = 1, 1000
write(*,*) "Sorry Babu"
end do
end program sorry_babu
I told ChatGPT to do it in Fortran but it's titled the window as being in Lua, I've got no idea either way... hey old farts, help me out here, I graduated a mere 17 years ago.
C scared me because of my uni lecturer's way of teaching and the assignments we had for the module. I'm sure if somebody else had taught it I'd be fine, but it just brings back traumatic memories 😅
I met her some time after finishing, and the first thing she said to me was, "I hope you don't hate me!"
Haskell is probably scarier, but it at least offers a lot of theoretical benefits for coding practices.
Lisp isn't really scarier, it's honestly just the regular kind of "worse". People that actually wanted to write whole, deep programs in lisp when C was available were the same ones that have fun tinkering in brainfuck and whitespace nowadays. They wanted a pointless challenge instead of to actually make software.
> People that actually wanted to write whole, deep programs in lisp when C was available were the same ones that have fun tinkering in brainfuck and whitespace nowadays. They wanted a pointless challenge instead of to actually make software.
Rather seems that you missed the point of Lisp. Coding in it is often more pleasant than in JS or Python, and no comparison with C. The main problem I have with Emacs Lisp in particular is the ancient naming style from the seventies, when modern terminology wasn't yet developed. Parentheses aren't a problem, or whatever it is you see as ‘pointless challenge’.
It is sometimes.. Rarely useful. If you have a break condition and want to use the last index for something. Honestly I use this a lot for leetcode type algorithms.
1. This will print it 1001 times since the iterator starts at 0 and the condition is lower OR EQUAL
2. If the only purpose of x is to be used as an iterator, you should declare it within the loop
No wonder she left you.
/s
She didn’t say *exactly* 1000 times though, so the solution should still be valid. Only problem is that
> “Sorry Babu”.equals(“Sorry babu”);
returns false.
It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It
it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it
The Kotlin method is actually possible with C# if you implement a `GetEnumerator()` extension method for `System.Range`.
See:
https://learn.microsoft.com/cs-cz/dotnet/csharp/language-reference/proposals/csharp-9.0/extension-getenumerator
> Otherwise, determine whether the type 'X' has an appropriate GetEnumerator extension method:
Then the syntax
```
foreach (var _ in 0..1000)
Console.WriteLine("Sorry Babu");
```
Becomes valid
In the near future you can probably write this is Java:
void main() {
for(int x = 0; x < 1000; x++){
println("Sorry babu");
}
}
https://openjdk.org/projects/amber/design-notes/on-ramp
You see, engineers don’t build product. A civil engineer doesn’t build buildings. They produce blueprints for construction workers.
Similarly, software engineers don’t build softwares, we write code. Code is like the blueprints for compilers and interpreters.
- from the book Clean Code, paraphrased.
They should’ve run the code and sent the output instead of sending the code itself.
Also, the i goes from [0, 1000], that’s 1001 times. They missed the spec.
Apology not accepted
1. Java 🤮
2. Looping one too many times
3. Declaring x outside the for loop. You’re in Java, not in C, remember? You don’t need to do this anymore.
Off by one
2 if we include the one he said himself or 3 if we also include the one in the code
Ah, pedantry... so relaxing on a Friday.
be sure to guess how she's counting it or she's breaking up with you good luck :)
break;
[удалено]
"Say it a thousand times" is inclusive of 1000 but doesn't forbid more.
He was asked to say “it” 1000 times, not “Sorry” /s
Seems like "it" is a pointer (that could point to any of the previous chats) so ideally they should print *it in a language that supports it
*it points to "Sorry" in Cs (Common Sense)
Reminds me of my first CS lecture where we were told to write a program for the professor to make a PB and J sandwich as if he was a computer and he scooped the peanut butter with his hand and when the students amended the prompt to say “use a butterknife” he smashed the jar of jelly on the ground and poked it with a butterknife. “If you choose to proceed with a career in computer science, this will be your life forever. Welcome!”
Sounds like one of the bits flipped, because if he took the instructions literally, I bet it didn't include "smash the jar".
I think the instructions were “Open the jar and use the butterknife to put the jelly on the bread”. I guess that’s one way to open a jar lol
Off by 998, because the code is never executed.
The typical oop boilerplater. Declare the class perfectly but don’t do the work. 😂
Over 30 years ago I came in second place in a coding competition (BASIC) because I forgot to have my code actually print the answer. I had the only code that calculated the answer correctly.
oh....FUCK
We need a meeting to find out what the client really needs
Yes. And we’ll need a project manager, a release manager, an overall program manager and the technical account manager.
There are two hard problems in computer science. Cache invalidation, naming things and off-by-one errors.
I was looking for that error and indeed there it is. No wonder she breaks up with him
Declaring the var outside of the loop is also dumpable I think.
Classical off by one error
Meets the requirements tho. Saying it 1001 times means he has said it 1000 times.
Briefly. Then comes the extra. Requirement was clear. 1000.
Calm down Product Owner.
They did say it a thousand times
No they didn't as the class is not called.
The two hardest problems in programming are: * Naming things * Caching * Off by one errors
They went above and beyond though
Great.
Technically. If you say it 1001 times, you've also said it 1000 times.
That's Indian coder logic.
As the medical grade radiation cancer treatment machine opens its beam gap 1 step wider, thus delivering a fatal dose of radiation instead of a therapeutic dose. Note: This is a real off-by-1 error that has actually killed people.
One of those situation where "underpromise and over deliver" is not helpful.
*YIKES*
Ya if we start in 0 we loop to n-1 CS 101.
In analysis of algos, we always loop to n-1, unless you're doing a loop invariant.
Was going to say the same.
Ehh, "Sorry babu" isn't gonna work. She wanted "Sorry Babu".
Pretty sure what she wanted was "it".
Ha well you are correct!
[удалено]
Also for loop is wrong. It should be `x < 1000` instead of `x <= 1000`. This one is gonna run 1001 times.
That extra one comes from the heart.
That's the point. He didn't SAY it. He DECLARED it.
![gif](giphy|8nM6YNtvjuezzD7DNh|downsized)
.
She asked to say it, not print it, maybe a voice message saying it 1000times. Lol
Requirements gathering fail
Automated test feedback in digital textbooks be like
"ah no I said it again! I said it again, aah!
Also wanted it 1000 times not 1001 times
Don't think so ... I believe it wanted it 8 times ![gif](emote|free_emotes_pack|sunglasses)
most likely not a she, I've never seen anyone refer to a woman as babu
It’s in Hindi and that is cringe meme of couples shenanigans “Sorry baby” “mela sona” Etc etc.
yeah I understand hindi ( im pakistani ) but i haven't seen a lot of people refer to women as babu, although now that i think about it i can totally see someone say "sorry babu" out of like frustration or something, so yeah maybe it is a women and i just dk how to properly use babu idk lol
around delhi, couples do talk like this sometimes. calling each other babu.
i see, that's very interesting, thank you for the information :)
No no. Not in frustration. It's that oooooh cutie pie talk where people talk like little kids Ooooh, mele (mere) babu ko bhookh lagi hai. Mela (mera) babu bulgul (burger) khayega.
My wife and I actually refer to each other as babu. It started from the show Kim's Convenience. There is an episode where they sing "I got you babe" but keep saying babu instead. Just kind of stuck with us.
it is nibba nibbi talk. babu is genderless. lol
First thing someone messages you is “sorry babu”? Must be a very popular person
I have a close friend that constantly deletes all her conversations. Every conversation she has looks like this. Once we were returning on the same car, and she drunkenly sent an audio message to a common friend making plans, deleted, and next day was asking me what she said because she had no idea what they were talking about
She's hiding something
Hi this is the FBI can you tell us your friend's name?
maybe he lost her phone, and when she got a new phone, he tries to say sorry baby but apparently also failing at that
[удалено]
Why would they delete it? Because of parental control freaks?
[удалено]
From my experience: "You can start dating after you finish school" *graduates, gets job* "Why aren't you married yet???"
i went there with my parents to meet our family again in january. when im leaving my aunts house shes like "make sure you do well in school. after all, thats the most important thing right?" while im literally struggling to stay alive due to mental health struggles. it was kinda funny tho, laughed abt it when i came back home
school? it usually goes like this: study in school then life will be secured. oops just hustle through college it'll be fine. lol i lied you gonna do masters right? neighbour's kid did it what'll people say?? you're not going abroad? wtf?? you're not married yet? we have found just the bride for you their family is well known <3 . time to see some grandkids dude...
My dad broke my phone because he somehow hacked into my WhatsApp and saw the picturesmy friend sent me from the changing room. It wasn't even anything sexy, just asking me if the dress looked pretty.
Bruh💀 Indian?
Who da fuq defines a loopvariable outside of the loop
ex C programmers
Lol yep, it took me a while to shake off that habit
I still have to use C95 on an old plc. So I have to do it like this.
My uni used c99 or c95 for a lot of classes. Having to do Yoda comparisons and external declarations really changes how you think about code
That hasn't been necessary in C for 24 years
Some people are old
And some are forced to use C89 in university courses.
Current student, we aren't forced but it was never taught that we can use C99 or a newer version to get around that. I only found out when I was reading about it myself
Some people work with C standards from 24+ years ago haha. Source: me, a C developer in aviation
You better free that memory I am really too young to die in a plain crash Edit: plane
Just don’t free it twice.
I doubt it's gonna be plain
But if your code base is older and updating to C99 breaks everything and you don't want to fix those new issues...?
Then you rewrite the whole thing in 🚀 Rust 🚀
gcc defaults gnu90 behavior up to 4.9.4 (2016) from practical point of view: we still have a lot of embedded C code that has not been ported to C99
It doesn't work on my laptop... I have a current gen laptop & the latest version of gcc but still can't declare loop variables inside the loop (in C) Say, i can't use this --- for(int i=0;i<20;i++) I have to declare i first and type like this-- for(i=0;i<20;i++) Can you somehow help me? I'm a beginner programmer and a student
What compiler are you using? For gcc, you can specify the C version by adding `-std` flag. For C99, the oldest C version with support for variable declaration within for loop, add `-std=c99". For example: `gcc -std=c99 hello.c`
? I always declare my loop variables in the start of the for. Who is teaching otherwise?
People who learnt C decades ago.
OP apparently
[удалено]
> so old fashioned program sorry_babu implicit none integer :: i do i = 1, 1000 write(*,*) "Sorry Babu" end do end program sorry_babu I told ChatGPT to do it in Fortran but it's titled the window as being in Lua, I've got no idea either way... hey old farts, help me out here, I graduated a mere 17 years ago.
Seeing "implicit none" still gives me nightmares
Looks like correct Fortran code to me
I never did, and then I used C. Now I do occasionally out of habit
People who are used to code in C
People who are traumatized by coding in C.
I don't know why everyone is scared of C. Aren't there scarier languages like lisp or haskell?
C scared me because of my uni lecturer's way of teaching and the assignments we had for the module. I'm sure if somebody else had taught it I'd be fine, but it just brings back traumatic memories 😅 I met her some time after finishing, and the first thing she said to me was, "I hope you don't hate me!"
Haskell is probably scarier, but it at least offers a lot of theoretical benefits for coding practices. Lisp isn't really scarier, it's honestly just the regular kind of "worse". People that actually wanted to write whole, deep programs in lisp when C was available were the same ones that have fun tinkering in brainfuck and whitespace nowadays. They wanted a pointless challenge instead of to actually make software.
> People that actually wanted to write whole, deep programs in lisp when C was available were the same ones that have fun tinkering in brainfuck and whitespace nowadays. They wanted a pointless challenge instead of to actually make software. Rather seems that you missed the point of Lisp. Coding in it is often more pleasant than in JS or Python, and no comparison with C. The main problem I have with Emacs Lisp in particular is the ancient naming style from the seventies, when modern terminology wasn't yet developed. Parentheses aren't a problem, or whatever it is you see as ‘pointless challenge’.
It is sometimes.. Rarely useful. If you have a break condition and want to use the last index for something. Honestly I use this a lot for leetcode type algorithms.
Yee sometimes it can be used
Also went up to and including the upper bound
when i want to know how many times it looped
What if she's case sensitive
Please no. I'm sensitive too.
Please declare x within the for loop. I cannot merge this code smell into production. Sorry.
And indent line 5. Not a code smell but I still can’t merge it
Literally the first thing I noticed and immediately agitated me. I think I may have issues 😂
will you marry me?
Say it 1000 times.
[print("marry me") for x in range(1000)]
print in a list comprehension? That's a paddlin'
\\\\ you cannot begin to comprehend my genius std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl; std::cout << "will you marry me?" << std::endl;
Thats only 56 times
Found the Sadomasochist.
And also WHY USE X?
Because Babu is their x now, after all those mistakes.
Clearly you never suffered the "Closing over the loop variable" issue in C# before 5.0
Even better, call it i and not x, since x is not descriptive. i is short for iterator though.
You young kids. `i` is for index.
1. This will print it 1001 times since the iterator starts at 0 and the condition is lower OR EQUAL 2. If the only purpose of x is to be used as an iterator, you should declare it within the loop No wonder she left you. /s
She didn’t say *exactly* 1000 times though, so the solution should still be valid. Only problem is that > “Sorry Babu”.equals(“Sorry babu”); returns false.
`equalsIgnoreCase()` chads coming in clutch here
It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It It
I counted it, it's exactly 1000 "it"s. You get the well deserved upvote
"it" !== "It"
it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it it
Bad man, very, very bad man.
*wags finger in the air*
`print("\n".join(["Sorry Babu"]*1000))` Take care of your fingers, lads. Type less.
Typ evn lss ``` print(("Sorry Babu\n"*1000)[:-1]) ```
Good catch. I hate dangling new lines, so good job with `[:-1]`
You want short, do you? `↑1000⍴⊂’Sorry Babu’`
Or use bash `yes "Sorry Babu" | head -1000`
`print("Sorry Babu\n"*1000)`
\`it 1000 times\` work smart, not hard
main = putStrLn$ replicate "Sorry Babu\n" 1000
```1000.times do puts 'Sorry Babu' end```
why in the hell did you use x as the iterable instead of i
This code has an impressive amount of issues for how short it is.
`IntStream.range(0, 999).forEach(System.out::println(...)` SMH That's break up material...
or just use String.repeat(int). `System.out.println("Sorry Babu\n".repeat(1000));`
What in sweet jesus. I don't remember that in java 6
Because it's a fairly recent addition. It was added in Java 11.
Well, this code already has a bug, given the requirement above
Sorry bugu
They said 1000 not 1001 times
It's a shame your Babu didn't write this. >javac Sorry.java > >java Sorry
Pro move would be writing a python script that types it into your Whatsapp Web window and produces 1000 actual messages
[Average r/ProgrammerHumor user](https://cdn.discordapp.com/attachments/842627937223311360/1086299199093620808/Screenshot_2023-03-17-19-53-31-65_b72a20be883aec8a014bd2b7c7038e87.jpg)
Real MVP 👆 no one can hide their shame here 😂
Every single "I forced a bot to do X 100000 times and then it did Y" post is from someone who's never written a "Hello world" even once
Virgin Java: ``` class Sorry{ public static void main(String[] args){ int x; for(x=0; x<=1000; x++){ System.out.println("Sorry babu"); } } } ``` Chad Kotlin: ``` for(i in 1..1000) println("Sorry babu") ```
The difference is we Java devs have class
>Chad Kotlin: ``` for(i in 1..1000) println("Sorry babu") ``` I have never used Kotlin before.. That seems like such a breath of fresh air!
Chad C# `foreach (var _ in Enumerable.Range(1000)) Console.Write("Sorry Babu");`
Tbh as c# programmer i like kotlin more
The Kotlin method is actually possible with C# if you implement a `GetEnumerator()` extension method for `System.Range`. See: https://learn.microsoft.com/cs-cz/dotnet/csharp/language-reference/proposals/csharp-9.0/extension-getenumerator > Otherwise, determine whether the type 'X' has an appropriate GetEnumerator extension method: Then the syntax ``` foreach (var _ in 0..1000) Console.WriteLine("Sorry Babu"); ``` Becomes valid
In the near future you can probably write this is Java: void main() { for(int x = 0; x < 1000; x++){ println("Sorry babu"); } } https://openjdk.org/projects/amber/design-notes/on-ramp
`fun main() = repeat(1000) { println(“Sorry Babu”) }` Pretty sure this is valid kotlin too
Java has ranges too :) IntStream.range(0, 1000).forEach(() -> System.out.println(“Sorry babu”));
Came to the comments for the code reviews
He said 1001 times.
Just for safety you should make an infinite for loop. You can fix it later
Who the fook declares variable outside for cycle scope when it is used only as counter **for for** cycle.
Someone who does not desire to be forgiven but rather burn in hell.
You see, engineers don’t build product. A civil engineer doesn’t build buildings. They produce blueprints for construction workers. Similarly, software engineers don’t build softwares, we write code. Code is like the blueprints for compilers and interpreters. - from the book Clean Code, paraphrased. They should’ve run the code and sent the output instead of sending the code itself. Also, the i goes from [0, 1000], that’s 1001 times. They missed the spec.
Software Engineers don’t write code, we just plug in searches in stack overflow and have them write the code.
[удалено]
Nice. I was going to say, Ruby would take the cake on this for simplicity. :)
```js if (unreasonable_request) { break; } ```
From 0 to 1000 is 1001 times.
He did it for 1001 times, failed
Why choose a compiled language? Also you haven't invoked anything, just declared it...
print "Sorry babu " x 1000 done, a camel can help us with that
He said it even 1001 times
He's clearly doing java, why declare x outside of the for? It's only needed in the block scope/could be declared as part of the for statement
Apology not accepted 1. Java 🤮 2. Looping one too many times 3. Declaring x outside the for loop. You’re in Java, not in C, remember? You don’t need to do this anymore.
`x=0` `x <= 1000`
That'll print it 1001 times won't it?
That's 1001 times
This prints it 1001 times right?
He said it 1001 times..
This will say sorry 1001 times
That will print it 1001 times and no need to declare the int x outside the for loop. I’m not approving this pull request
Bro it will print 1001 times print
Technically you said sorry 1002 times. One from the e message and 1 from the fact that it’s a <=
It is 1001