We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Denying machine

From Esolang
Jump to navigation Jump to search

A denying machine is a machine that does

  • reads input
  • set A to 0
  • label a
  • if input!=0:
  • output A
  • terminate program
  • otherwise:
  • A+=1
  • goes to label a

Interpreters

><>

i:?v
nl+<;

Gray Snail

Hypothetically, you could add 1 in any base, but unary is the easiest.

INPUT input
POP a A a0
a
GOTO "input is 0" [input] 0
OUTPUT [A]
GOTO end a a
"input is 0"
POP a A a[A]0
GOTO a a a
end

node.js

a=i=0;while(!(i=+prompt()))a++;console.log(a)

See also