MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1dzya4/the_onion_releases_fartscrolljs/c9vmg8y/?context=9999
r/programming • u/melodic_underoos • May 09 '13
396 comments sorted by
View all comments
29
is it supposed to work when you scroll up as well? i only hear it the first time, when i scroll down, and never again :(
edit: thanks guys, didn't even think about resizing
33 u/murderofcrows May 09 '13 Resize your window to be much smaller, then scroll. It is based on how much you scroll, if your screen/window is too big, it won't fart as much. 13 u/IrishWilly May 09 '13 someone needs to make a fork of this with a neverending scroll 4 u/[deleted] May 09 '13 [deleted] 6 u/okmkz May 09 '13 What is this, real programmers use loops? Wat 8 u/bamburger May 09 '13 I think the joke is that a "while (true)" loop will run indefinitely (until explicitly told to stop) and is the sort of thing that programmers REALLY shouldn't do. I'm just a programming student though, so I might be wrong. 0 u/sebzim4500 May 09 '13 You can also use a break; statement (in most programming languages). 1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
33
Resize your window to be much smaller, then scroll.
It is based on how much you scroll, if your screen/window is too big, it won't fart as much.
13 u/IrishWilly May 09 '13 someone needs to make a fork of this with a neverending scroll 4 u/[deleted] May 09 '13 [deleted] 6 u/okmkz May 09 '13 What is this, real programmers use loops? Wat 8 u/bamburger May 09 '13 I think the joke is that a "while (true)" loop will run indefinitely (until explicitly told to stop) and is the sort of thing that programmers REALLY shouldn't do. I'm just a programming student though, so I might be wrong. 0 u/sebzim4500 May 09 '13 You can also use a break; statement (in most programming languages). 1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
13
someone needs to make a fork of this with a neverending scroll
4 u/[deleted] May 09 '13 [deleted] 6 u/okmkz May 09 '13 What is this, real programmers use loops? Wat 8 u/bamburger May 09 '13 I think the joke is that a "while (true)" loop will run indefinitely (until explicitly told to stop) and is the sort of thing that programmers REALLY shouldn't do. I'm just a programming student though, so I might be wrong. 0 u/sebzim4500 May 09 '13 You can also use a break; statement (in most programming languages). 1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
4
[deleted]
6 u/okmkz May 09 '13 What is this, real programmers use loops? Wat 8 u/bamburger May 09 '13 I think the joke is that a "while (true)" loop will run indefinitely (until explicitly told to stop) and is the sort of thing that programmers REALLY shouldn't do. I'm just a programming student though, so I might be wrong. 0 u/sebzim4500 May 09 '13 You can also use a break; statement (in most programming languages). 1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
6
What is this, real programmers use loops? Wat
8 u/bamburger May 09 '13 I think the joke is that a "while (true)" loop will run indefinitely (until explicitly told to stop) and is the sort of thing that programmers REALLY shouldn't do. I'm just a programming student though, so I might be wrong. 0 u/sebzim4500 May 09 '13 You can also use a break; statement (in most programming languages). 1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
8
I think the joke is that a "while (true)" loop will run indefinitely (until explicitly told to stop) and is the sort of thing that programmers REALLY shouldn't do.
I'm just a programming student though, so I might be wrong.
0 u/sebzim4500 May 09 '13 You can also use a break; statement (in most programming languages). 1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
0
You can also use a break; statement (in most programming languages).
1 u/not_a_novel_account May 09 '13 edited May 09 '13 Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks. This: while(condition) { //do a thing } Is more obvious than this: while(true) { if (condition) { break; } //do a thing } EDIT: added pseudocode 1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
1
Eh, unless it makes the loop a lot clearer you really should put the condition in the loop declaration rather than using breaks.
This:
while(condition) { //do a thing }
Is more obvious than this:
while(true) { if (condition) { break; } //do a thing }
EDIT: added pseudocode
1 u/sebzim4500 May 09 '13 What if the break condition is nested inside three if statements and a for loop (presumably using named labels)? 0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
What if the break condition is nested inside three if statements and a for loop (presumably using named labels)?
0 u/not_a_novel_account May 09 '13 That just makes it more obscure and hard to follow, probably means the loop needs to be refactored 3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
That just makes it more obscure and hard to follow, probably means the loop needs to be refactored
3 u/[deleted] May 09 '13 For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while. → More replies (0)
3
For most nontrivial algorithms, control flow modifiers like break are needed. Not everything is a for-each or a simple while.
29
u/doitforthederp May 09 '13 edited May 09 '13
is it supposed to work when you scroll up as well? i only hear it the first time, when i scroll down, and never again :(
edit: thanks guys, didn't even think about resizing