This is the correct way to write a while loop

This is the correct way to write a while loop

If you disagree you probably never received formal CS education

while True:
ok

> you probably never received formal CS education
Thank fuck for that!

I didnt fall for the tertiary education Jew

>I didn't fall for a sure path to higher wages and better career progression

gee I envy you

>what is do while
Looks like you didn't receive an education either

>doesn't know about do-while
you tried

he was born without a penis or vagina. he doesn't even pee

if(shitPost.hasNext()){
while(true){
shitpost.Next();
if(!shitPost.hasNext()){
break;
}
}
}

epic loop d00d

>.hasNext
>!.hastNext

kys

much safer. merged.

fired.

do {
shitPost.next();
} while (youCount < dailyGoal);
t. MS Computer Science

Fucking /code tag broke. Goddammit.

while(shitPost.hasNext()) {
shitPost.Next();
}

nice try wageslave

superior perl
shitPost() while youCount < dailyGoal;

The true patrician way:
loop:
shitPost.next();
if (youCount < dailyGoal) {
goto loop;
}

while (!shitPost.empty)
{
shitPost.popFront;
}

unironically

while (true)
youCount => dailyGoal ? break : shitPost.next();

++++++++++[>+>+++>+++++++>++++++++++-------------.++++++++++++++.+++++++..----.---.+++++++..+++.+++++.------------.---.+++++++++++++.-------------.---.++++++++++++++++.-----------------.++++++++.+++++.--.-------.+++++++++++++++.

worst in the thread

go away

fuck you

while (OP == faggot) {

}

Why don't people like for loops?

because its 2017?

OK buddy keep writing shitty code for Linux and praying that daddy Torvalds accepts it

does this work like a callback, and call the loop then push a new item to an array?

They're too stupid to understand them.

Probably this. It took 2 classes over Python and Java before I finally understood how they worked.

in stuff like bash aren't while loops more 'robust'? Quicker and less prone to failing with multi-threads and what not

im genuinely 100% amateur so feel free to flame

shitposting = True

while shitposting:
shit_post.again()
if post_count >= daily_goal:
shitposting = False

for (; youCount < dailyGoal; shitPost.next()) ;
also it doesn't read very well

while (shitpost.hasNext() === true) {
shitpost.next();

if (shitpost.hasNext() == false) {
break;
}
}

Real brainlets know loops.

>===
>unironically writing javascript

reddit is in the other direction

'''let rec shitpost condf = match (condf ()) with
| true -> "OP is fag"
| false -> (shitpost condf)'''

> g is only autists with no concept of humor

for(youCount = 0; youCount < dailyGoal; youCount++){
shitpost.next();
}


Looks fine to me.

> higher wages and better career progression

meanwhile, in real life, most people would post like this (if they were honest)

> Be me 2017
> Graduated 1.5 year ago with 4 year compsci degree
> can't get job in my field, have to work at taco bell atm
> friends always bug me to fix their computers
> might try to work at geeksquad tho, for that $1.50 pay increase
> tried to work on my portfolio yesterday, had no idea what to do after putting `main` in my python code.
> attended a bootcamp last weekend, still can't code. Not sure why.
> might need to default next year, if I can't get a job in my field. My parents are planning on kicking me out, since I can only give them $25 for rent and they want $50.

meanwhile, in the correct field:

> Be 4 year math grad, minor in CS
> self-taught programmer since age 10
> love my craft
> really good at economics
> still live with parents, but they dont care cause not only do I pay rent, i take them out to eat
> 6 figures/yr, remotely.

feels good :)

>be me
>major in compsci
>intern at google
>six figure offer before graduation

try having a brain :)

for((i=1;i

> google
> the company that hires people based on skin pigmentation instead of knowledge

o-okay.

loop while not false
try
shitpost.postnext()
catch e
throw e
pool

Because they are brainlets.

truly patrician

mapM_ (putStrLn . (++) "shitpost #" . show) ([1..] :: [Int])

that's not a while loop, that's a for loop.
for (; youCount < dailyGoal; shitPost.next) {}

> break:
off yourself

Oh, you’re black?

post = () => {
shit.post();
if(! youCount >= dailyGoal) post();
}

This.
Early termination of a loop and you think you've had a formal CS education. You're a troglodyte.

kek

oh, you're jealous and unsuccessful?

>all those unnecessary spaces
Close, but no cigar. Try again

lololololololo he's prolly a chinamen amirtie mih nigga

>spacing any less than this

Are you trying to make everyone who touches your code quit?

good luck getting out.

>be fresh grad
>join google, cuz they are google
>shit starts to get annoying, all i do is mindless helpdesk work.
>i want to quit
>quit
>get interview for a SE in corporate
>hr bitch: sooo user I see google fired you
>explain that I quit
>hr bitch: why would quit google
>explain all the helpdesk work
>interview goes on she finishes saying that she will call to schedule the technical interview
>that was 3 months ago.

helpdesk work? what the fuck?

I was a software engineer intern and even I didn't do help desk work, I wrote actual production code that they are still using right now.

You got fucked buddy

>if true == true
kys brainlet

>other people touching my code
nope, chuck testa

why males are so dumb for code?

fancyLoop:
globalArgument1 = something;
goto shitPost;
if ( youCount > dailyGoal || youCount == dailyGoal )
goto fancyLoop;
else
goto end;
end:

is this some kind of pseudo assembly? Get out

Goto is a feature of C and C++, little one

its fucking C you moron.

while :;do shitpost; done

function shitpost() {
if(dailygoal()) {
return;
}
shitpost'();
shitpost();
}

>he uses loops

Sup Forums???

They let interns write their shit? Is that why youtube sucks so much?

why use 'while' loops when 'for' loops exists?

loop{
p hello world
}

Just remember, that in Assembler times, you had to use gotos to manage that

I actually like it. with a while loop there is always the question where the condition will be tested, and even if there isnt, you might want to break on other conditions, or at a different step.

your form makes it extremely obvious what happens and is easily modifiable

>C
>pseudo assembly
that was the joke, m8

needs more semicolons

Computer science is about programming the same way Biology is about gardening.

int main(int argc){
shit.Shit();
if (argc == succ)
kill(getpid(), 9);
else
main(argc+1);

hahah i know plenty of brogrammers with diplomas who do
while ()
{
int i;
if (true)
{
int kek;
}
}

>youCount not initialized

for (;;) > while (true)

I really have no idea when to use for or while

r8h8
while(true){
shitPost.next();
if (youCount >= dailyGoal){
Throw new Exception("Done");
}
}

next:
shitPost.next();
youCount >= dailyGoal ? goto last : goto next;
last:


Amateur.

Wrong. Early rejection is a proper way to terminate loops and in many cases, preferred method.

exceptions are for handling things that are "exceptional" as name implies. Using them for control flow is a bad habit.

@echo off
:A
start
goto A

Save as anything.bat and run

It isn't working for me???

>this pic
>CS = code monkeying
Brainlets everybody!

>shitPost.next
>yourCount
>dailyGoal
>break

It's a mess dude

They're usually if you know exactly how many iterations you want. In this case, the while loop lets you keep shitposting until you get the amount of (yous) you want.

while (auto shitpost = shitpost.next());

>what is recursion

>re(((curse)))ion

WHY THE FUCK WOULD YOU WRITE A RECURSIVE METHOD FOR THIS

iterative implementations are always better when you can help it. Please relearn your fundamentals

test
test
test

test
test

test

test

testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestv

MUH TESTAS
MUH TESTAS
MUH TESTAS
MUH TESTAS
MUH TESTAS
MUH TESTAS

if(main())
{
print "this"
}

DOUBLE
GET

>while loops
>not using parallelism
enjoy your shit performance

#pragma omp for ordered schedule(dynamic)
for(; youCount < dailyGoal; youCount++)
shitPost.next();

>multiprocessing instead of multithreading

According to compiler explorer, the compiler will generate some massive SIMD stuff no human could possibly understand anyway.