Click here to Skip to main content
15,120,459 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: That's one way to do it Pin
KateAshman18-Aug-21 1:07
MemberKateAshman18-Aug-21 1:07 
GeneralRe: That's one way to do it Pin
Richard Deeming18-Aug-21 1:12
mveRichard Deeming18-Aug-21 1:12 
GeneralRe: That's one way to do it - It's a joke for sure! Pin
Peter Kelley 202118-Aug-21 2:56
MemberPeter Kelley 202118-Aug-21 2:56 
GeneralRe: That's one way to do it - It's a joke for sure! Pin
Richard Deeming18-Aug-21 3:08
mveRichard Deeming18-Aug-21 3:08 
GeneralRe: That's one way to do it Pin
Slow Eddie18-Aug-21 2:56
professionalSlow Eddie18-Aug-21 2:56 
GeneralRe: That's one way to do it Pin
Slow Eddie18-Aug-21 2:56
professionalSlow Eddie18-Aug-21 2:56 
JokeRe: That's one way to do it Pin
englebart18-Aug-21 3:17
professionalenglebart18-Aug-21 3:17 
GeneralRe: That's one way to do it Pin
atverweij18-Aug-21 4:04
Memberatverweij18-Aug-21 4:04 
That can be done better with a recursive function:

function IsEven(number) {
  if (number === 1 return false;
  elseif (number === 2) return true;
  else return IsEven(number - 2);
}

Now it does all positive numbers Laugh | :laugh:


EDIT: because I get serious reactions on this code
The code above is how NOT to do it - it's satire.

modified 20-Aug-21 8:19am.

GeneralRe: That's one way to do it Pin
dandy7218-Aug-21 4:21
Memberdandy7218-Aug-21 4:21 
GeneralRe: That's one way to do it Pin
atverweij18-Aug-21 4:48
Memberatverweij18-Aug-21 4:48 
GeneralRe: That's one way to do it Pin
dandy7218-Aug-21 6:57
Memberdandy7218-Aug-21 6:57 
GeneralRe: That's one way to do it Pin
BruceCarson18-Aug-21 7:49
MemberBruceCarson18-Aug-21 7:49 
GeneralRe: That's one way to do it Pin
atverweij18-Aug-21 8:25
Memberatverweij18-Aug-21 8:25 
GeneralRe: That's one way to do it Pin
BruceCarson18-Aug-21 14:52
MemberBruceCarson18-Aug-21 14:52 
GeneralRe: That's one way to do it Pin
atverweij19-Aug-21 3:00
Memberatverweij19-Aug-21 3:00 
GeneralRe: That's one way to do it Pin
kapalmuks<329-Aug-21 12:58
Memberkapalmuks<329-Aug-21 12:58 
GeneralRe: That's one way to do it Pin
Member 798912218-Aug-21 15:59
MemberMember 798912218-Aug-21 15:59 
GeneralRe: That's one way to do it Pin
atverweij19-Aug-21 3:00
Memberatverweij19-Aug-21 3:00 
GeneralRe: That's one way to do it Pin
Bernhard Hiller19-Aug-21 22:12
MemberBernhard Hiller19-Aug-21 22:12 
GeneralRe: That's one way to do it Pin
atverweij20-Aug-21 2:32
Memberatverweij20-Aug-21 2:32 
GeneralRe: That's one way to do it Pin
kapalmuks<329-Aug-21 12:41
Memberkapalmuks<329-Aug-21 12:41 
GeneralRe: That's one way to do it Pin
MarkTJohnson18-Aug-21 4:23
professionalMarkTJohnson18-Aug-21 4:23 
GeneralRe: That's one way to do it Pin
wapiti6418-Aug-21 5:54
Memberwapiti6418-Aug-21 5:54 
GeneralRe: That's one way to do it Pin
Daniel Pfeffer19-Aug-21 0:22
professionalDaniel Pfeffer19-Aug-21 0:22 
GeneralRe: That's one way to do it Pin
Jörgen Andersson24-Aug-21 8:53
professionalJörgen Andersson24-Aug-21 8:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.