RosettaCodeData/Task/Count-in-octal/Liberty-BASIC/count-in-octal-1.basic
2023-07-01 13:44:08 -04:00

26 lines
736 B
Text

'the method used here uses the base-conversion from RC Non-decimal radices/Convert
'to terminate hit <CTRL<BRK>
global alphanum$
alphanum$ ="01234567"
i =0
while 1
print toBase$( 8, i)
i =i +1
wend
end
function toBase$( base, number) ' Convert decimal variable to number string.
maxIntegerBitSize =len( str$( number))
toBase$ =""
for i =10 to 1 step -1
remainder =number mod base
toBase$ =mid$( alphanum$, remainder +1, 1) +toBase$
number =int( number /base)
if number <1 then exit for
next i
toBase$ =right$( " " +toBase$, 10)
end function