Multiplication tables: Difference between revisions

Content added Content deleted
Line 51: Line 51:


=={{header|AppleScript}}==
=={{header|AppleScript}}==
<lang AppleScript >on f(x)
<lang AppleScript >set 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
repeat with x from 0 to n
if x = 0 then set {R, x} to {{return}, -1}
if x = 0 then set {R, x} to {{return}, -1}
Line 63: Line 58:
if x > 0 then set RR to {f(x as string)}
if x > 0 then set RR to {f(x as string)}
if x = -1 then set {RR, x} to {{f("x")}, 1}
if x = -1 then set {RR, x} to {{f("x")}, 1}
--if x > 0 then set RR to {f(x as string)}
else
else
if y ≥ x then set end of RR to f(x * y)
if y ≥ x then set end of RR to f(x * y)
Line 72: Line 66:
end repeat
end repeat
return R as string
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:
</lang>Output:
<pre>"
<pre>"