loading...

Discussion on: Challenge: Write a program that never stops

Collapse
jessydmd profile image
Jessy
function a(){
  a();
}

a();

Endless recursivity!

Collapse
halt_6kere9 profile image
Halt! 6 kere 9?

This will crash once the stack is full but nice try. :)

Collapse
jessydmd profile image
Jessy

Hahaha yeah it totally did crash Chrome when I tried it. I wanted to just post

while(true){}

but that's a little boring.

Thread Thread
halt_6kere9 profile image
Halt! 6 kere 9?

Definitely classic but lacks the humor :)

Collapse
arne_mertz profile image
Arne Mertz

Use a language that allows optimization of tail recursion then ¯_(ツ)_/¯

Thread Thread
gefjon profile image
Phoebe Goldman

Us cool kids with our tail recursion could write in, for example, Common Lisp:

(defun loop-for-ever ()
  (loop-for-ever))
(loop-for-ever)