Sort three variables: Difference between revisions
Content added Content deleted
(better?) |
Alpha bravo (talk | contribs) (added AutoHotkey) |
||
Line 125: | Line 125: | ||
+77444 |
+77444 |
||
</pre> |
</pre> |
||
=={{header|AutoHotkey}}== |
|||
<lang AutoHotkey>SortThreeVariables(ByRef x,ByRef y,ByRef z){ |
|||
obj := [] |
|||
for k, v in (var := StrSplit("x,y,z", ",")) |
|||
obj[%v%] := true |
|||
for k, v in obj |
|||
temp := var[A_Index], %temp% := k |
|||
}</lang> |
|||
Examples:<lang AutoHotkey>x = lions, tigers, and |
|||
y = bears, oh my! |
|||
z = (from the "Wizard of OZ") |
|||
SortThreeVariables(x,y,z) |
|||
MsgBox % x "`n" y "`n" z |
|||
x = 77444 |
|||
y = -12 |
|||
z = 0 |
|||
SortThreeVariables(x,y,z) |
|||
MsgBox % x "`n" y "`n" z |
|||
return</lang> |
|||
Outputs:<pre>--------------------------- |
|||
(from the "Wizard of OZ") |
|||
bears, oh my! |
|||
lions, tigers, and |
|||
--------------------------- |
|||
-12 |
|||
0 |
|||
77444 |
|||
---------------------------</pre> |
|||
=={{header|C sharp}}== |
=={{header|C sharp}}== |