Jump to content

Multiplication tables: Difference between revisions

Line 51:
 
=={{header|AppleScript}}==
<lang AppleScript >onset f(x)n to 12 -- Size of table.
set text item delimiters to ""
return (characters -4 thru -1 of (" " & x)) as string
end f
 
set n to 12
repeat with x from 0 to n
if x = 0 then set {R, x} to {{return}, -1}
Line 63 ⟶ 58:
if x > 0 then set RR to {f(x as string)}
if x = -1 then set {RR, x} to {{f("x")}, 1}
--if x > 0 then set RR to {f(x as string)}
else
if y ≥ x then set end of RR to f(x * y)
Line 72 ⟶ 66:
end repeat
return R as string
 
-- Handler/Function for formatting fixed width integer string.
on f(x)
set text item delimiters to ""
return (characters -4 thru -1 of (" " & x)) as string
end f
</lang>Output:
<pre>"
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.