Sort three variables: Difference between revisions

Content added Content deleted
m (Fix Perl 6 -> Raku in comments, typos)
(Added AppleScript solution.)
Line 240: Line 240:
+0
+0
+77444</pre>
+77444</pre>

=={{header|AppleScript}}==

<lang applescript>set x to "lions, tigers, and"
set y to "bears, oh my!"
set z to "(from the \"Wizard of OZ\")"

if (x > y) then set {x, y} to {y, x}
if (y > z) then
set {y, z} to {z, y}
if (x > y) then set {x, y} to {y, x}
end if

return {x, y, z}</lang>

{{output}}
<pre>{"(from the \"Wizard of OZ\")", "bears, oh my!", "lions, tigers, and"}</pre>

<lang applescript>set x to 77444
set y to -12
set z to 0

if (x > y) then set {x, y} to {y, x}
if (y > z) then
set {y, z} to {z, y}
if (x > y) then set {x, y} to {y, x}
end if

return {x, y, z}</lang>

{{output}}
<pre>{-12, 0, 77444}</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==