# Looping counter

(Redirected from Looping Counter)

A looping counter counts up to infinity or a specific number (or possibly down to a specific number or negative infinity). Counting from 99 to 0 can be used as a simpler alternative of the 99 bottles of beer program to prove that a language is usable for computation.

The program exhausts unbounded memory over infinite time. It prints each value as it counts, and it exhausts infinite states in infinite time. The program is essentially an unbounded unary counter.

The output of a looping counter is as follows:

```*
**
***
****
*****
******
*******
********
*********
**********
***********
************
```

With each iteration, the memory used grows.

## Examples

### ()()(())

```((())(()))
```

### ()NEST()

```  [*]
[][*
[] *
[]

(N)
```

### ///

Two examples are available on the page ///, printing rows of increasingly many asterisks with each run.

### 95-98

```A-A 41-43 0-1 A-A
```

### Befunge

```1:v,*25<
:    :
v_\$1+ ^
"
*:
"-
,1
>^
```

### Black

A looping counter written in Black can be found at Black#Example program.

The looping counter was used as the first demonstration that Black was possibly Turing-complete. (Although a looping counter does not prove Turing-completeness in its own right, it helps to demonstrate how a language is capable of storing and retrieving arbitrary amounts of data, which is often one of the hardest aspects of Turing-completeness to discover within a language.)

### Brainfuck

```>>++++++++++[[->+<<++++>]<++[<]>[.>]>.]
```

### G#

```integer assign n as 0
make main; [
loop [
print(#n)
assign #a as 1 +
]
]
```

### NO(t) MORE(than)

```([#])([#])([#])
```

### Not

```1#1[1+=#N]
```

### REG.TYPE = STR TRUE

``` #+"*"A/(o[1]+"*"<+"/n")
```

```VAR x
VAR y
VAR z
VAR one
S x 1
S one 1
S z 10
C x y
P "*"
SU y one
JB y 2
OC z
JB one 5
```

### STIYALFICL

```page 1: "*)"
----
1 owns *)
2 owns *
----
checklist:
avoid 1 by rewriting as **)
avoid 1 by rewriting as *
see page 1
avoid 2 by rewriting as *)
```

### Subleq

```42 1 7 0 0 0 0 3 1 10
5 4 13 6 5 16 5 5 19
6 1 28 0 -1 25
5 5 19
4 3 0 9 -1 0 5 5 10
```

The 42 can be altered to print any character you like.

### Unlambda

`````ci`.*`c`.*r
```

or with an extra newline

`````ci`.*`cr
```

### UTC+8

```无限地（重复循环次数次输出“*”然后输出字符10）。
```

### XUS

using `{}` instead of `*`:

```= counter {}
X Counter
(X Counter Y Counter)
```