Count in octal: Difference between revisions

Content added Content deleted
(→‎Whitespace: Add implementation)
Line 1,094: Line 1,094:
[[Category:Radices]]
[[Category:Radices]]
[[Category:Iteration]]
[[Category:Iteration]]

=={{header|Whitespace}}==

This program prints octal numbers until the internal representation of the current integer overflows to -1; it will never do so on some interpreters.

<lang Whitespace>








</lang>

It was generated from the following pseudo-Assembly.

<lang asm>push 0
; Increment indefinitely.
0:
push -1 ; Sentinel value so the printer knows when to stop.
copy 1
call 1
push 10
ochr
push 1
add
jump 0
; Get the octal digits on the stack in reverse order.
1:
dup
push 8
mod
swap
push 8
div
push 0
copy 1
sub
jn 1
pop
; Print them.
2:
dup
jn 3 ; Stop at the sentinel.
onum
jump 2
3:
pop
ret</lang>


=={{header|XPL0}}==
=={{header|XPL0}}==