Balanced ternary: Difference between revisions
m
→{{header|11l}}: `-I/`
Alextretyak (talk | contribs) (→{{header|11l}}: Static type variables and static methods are supported now) |
Alextretyak (talk | contribs) m (→{{header|11l}}: `-I/`) |
||
Line 29:
{{trans|Python}}
<syntaxhighlight lang="11l">
:str2dig = [‘+’ = 1, ‘-’ = -1, ‘0’ = 0]
:dig2str = [1 = ‘+’, -1 = ‘-’, 0 = ‘0’]
Line 51 ⟶ 46:
R [Int]()
V n3 = ((n % 3) + 3) % 3
I n3 == 0 {R [0] [+] .:int2ternary
I n3 == 1 {R [1] [+] .:int2ternary
I n3 == 2 {R [-1] [+] .:int2ternary
X RuntimeError(‘’)
|