Multiplication tables: Difference between revisions
Content added Content deleted
(CoffeeScript) |
(→{{header|CoffeeScript}}: minor refactor) |
||
Line 577:
=={{header|CoffeeScript}}==
<lang coffeescript>
pad = (s, n=4, c=' ') ->▼
s = s.toString()▼
result = ''▼
padding = n - s.length▼
while result.length < padding▼
result += c▼
result + s▼
print_multiplication_tables = (n) ->
width = 4
▲ s = s.toString()
▲ result = ''
▲ padding = n - s.length
▲ while result.length < padding
▲ result += c
▲ result + s
s = pad('') + '|'
for i in [1..n]
Line 607 ⟶ 608:
print_multiplication_tables 12
</lang>
output
Line 626 ⟶ 629:
12| 144
</lang>
=={{header|Common Lisp}}==
|