MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/ps3dv5/but_why_from_production/
r/badcode • u/CynicalFucc • Sep 20 '21
11 comments sorted by
5
Image Transcription: Code
for ($x = 1; $x <= count($array); $x++) { $bool_variable = some_function($array[$x-1]); };
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
That's what happens when you learn Pascal/Delphi in university. Pretty much every commercially popular language is derived from C.
2
Does some_function preserve an internal state that informs it's logic?
4 u/CynicalFucc Sep 20 '21 no.. but it was mainly posted because of the unnecessary indexing.. = 0, < count, [$x]... not that hard.. -1 u/kallefrommalle Sep 21 '21 Maybe the first element shouldn't be considered?🤔 5 u/MattiDragon Sep 21 '21 No. See the function gets x - 1 0 u/kallefrommalle Sep 21 '21 Erm ok, then maybe the last element shouldn't be considered but they have a strict policy to never use math in for loop conditions. 2 u/[deleted] Sep 21 '21 Also thought the same, but then " <= " ... So nop, last element will also get picked up 1 u/kallefrommalle Sep 21 '21 It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO 1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
4
no.. but it was mainly posted because of the unnecessary indexing.. = 0, < count, [$x]... not that hard..
-1 u/kallefrommalle Sep 21 '21 Maybe the first element shouldn't be considered?🤔 5 u/MattiDragon Sep 21 '21 No. See the function gets x - 1 0 u/kallefrommalle Sep 21 '21 Erm ok, then maybe the last element shouldn't be considered but they have a strict policy to never use math in for loop conditions. 2 u/[deleted] Sep 21 '21 Also thought the same, but then " <= " ... So nop, last element will also get picked up 1 u/kallefrommalle Sep 21 '21 It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO 1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
-1
Maybe the first element shouldn't be considered?🤔
5 u/MattiDragon Sep 21 '21 No. See the function gets x - 1 0 u/kallefrommalle Sep 21 '21 Erm ok, then maybe the last element shouldn't be considered but they have a strict policy to never use math in for loop conditions. 2 u/[deleted] Sep 21 '21 Also thought the same, but then " <= " ... So nop, last element will also get picked up 1 u/kallefrommalle Sep 21 '21 It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO 1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
No. See the function gets x - 1
x - 1
0 u/kallefrommalle Sep 21 '21 Erm ok, then maybe the last element shouldn't be considered but they have a strict policy to never use math in for loop conditions. 2 u/[deleted] Sep 21 '21 Also thought the same, but then " <= " ... So nop, last element will also get picked up 1 u/kallefrommalle Sep 21 '21 It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO 1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
0
Erm ok, then maybe the last element shouldn't be considered but they have a strict policy to never use math in for loop conditions.
2 u/[deleted] Sep 21 '21 Also thought the same, but then " <= " ... So nop, last element will also get picked up 1 u/kallefrommalle Sep 21 '21 It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO 1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
Also thought the same, but then " <= " ... So nop, last element will also get picked up
1 u/kallefrommalle Sep 21 '21 It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO 1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
1
It shouldn't consider the last element before the last element and any arithmetic in the for loop condition has been forbidden by the CEO
1 u/mansdem Sep 21 '21 How are you so sure it was the CEO that forbade it
How are you so sure it was the CEO that forbade it
I was browsing through some old code at work, and ran into a method called DoTheThingGetThePoints(). It had nothing to do with a game.
DoTheThingGetThePoints()
5
u/seeroflights Sep 21 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
5
u/_pelya Sep 21 '21
That's what happens when you learn Pascal/Delphi in university. Pretty much every commercially popular language is derived from C.
2
u/[deleted] Sep 20 '21
Does some_function preserve an internal state that informs it's logic?
2
u/wknight8111 Sep 21 '21
I was browsing through some old code at work, and ran into a method called
DoTheThingGetThePoints(). It had nothing to do with a game.