COUNT!!1

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
	UP VAR!!1
	VISIBLE VAR
	IZ VAR BIGGER THAN 10? KTHXBYE
IM OUTTA YR LOOP
KTHXBYE

We've seen HAI, KTHXBYE, CAN HAS, and VISIBLE already in the listing for HAI WORLD. We learn a bit about variables in this one.

  • Declaration is handled with I HAS A. The (dynamically typed) variable follows.
  • IM IN YR and IM OUTTA YR clearly demarcate a loop construct. LOOP in this example is simply a label.
  • UP is an increment operator. The (optional, default=1) argument follows !!
  • The IZ … ? construct is the basic conditional form. In this example, it terminates on the same line with a simple KTHXBYE command, here used as a BREAK.
  • BIGGER THAN is a comparator.

Early consensus from the first irc meeting suggests a slight change from the original code:

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
	UPZ VAR!!1
	VISIBLE VAR
	IZ VAR BIGR THAN 10? GTFO. KTHX
KTHX
KTHXBYE

Further language features are still pending.

examples/count-1.txt · Last modified: 2007/05/31 09:54 by atl
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki