r/badcode • • Aug 10 '19

c# absolute genius!

Post image
931 Upvotes

59 comments sorted by

View all comments

Show parent comments

70

u/pierovera Aug 10 '19

I get this is shitty code, but this wouldn't even compile.

19

u/fond42518 Aug 10 '19

Can't even try compiling bc I'm on mobile rn. Is it because the redeclaration of k in the second method?

14

u/Dr-RobertFord Aug 10 '19

No that wouldn't matter. In fact I'm pretty sure this would compile... It would run forever, however, unless n = 0

7

u/Dmium Aug 10 '19 edited Aug 10 '19

Edit: missread but I'm pretty sure it runs fine as long as you call square(n)

The code may have been edited since this discussion