Jump to content

Sort three variables: Difference between revisions

→‎{{header|AppleScript}}: Added alternative code.
(Added AppleScript solution.)
(→‎{{header|AppleScript}}: Added alternative code.)
Line 272:
{{output}}
<pre>{-12, 0, 77444}</pre>
 
Longer, but more efficiently:
 
<lang applescript>set x to "lions, tigers, and"
set y to "bears, oh my!"
set z to "(from the \"Wizard of OZ\")"
 
tell x
if (it > y) then
set x to y
set y to it
end if
end tell
tell z
if (it < y) then
set z to y
if (it < x) then
set y to x
set x to it
else
set y to it
end if
end if
end tell
 
return {x, y, z}</lang>
 
=={{header|AutoHotkey}}==
557

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.