RosettaCodeData/Task/Sort-three-variables/Seed7/sort-three-variables.seed7

30 lines
779 B
Plaintext

$ include "seed7_05.s7i";
const proc: genSort3 (in type: elemType) is func
begin
global
const proc: doSort3 (in var elemType: x, in var elemType: y, in var elemType: z) is func
local
var array elemType: sorted is 0 times elemType.value;
begin
writeln("BEFORE: x=[" <& x <& "]; y=[" <& y <& "]; z=[" <& z <& "]");
sorted := sort([](x, y, z));
x := sorted[1];
y := sorted[2];
z := sorted[3];
writeln("AFTER: x=[" <& x <& "]; y=[" <& y <& "]; z=[" <& z <& "]");
end func;
end global;
end func;
genSort3(integer);
genSort3(string);
const proc: main is func
begin
doSort3(77444, -12, 0);
doSort3("lions, tigers, and", "bears, oh my!", "(from the \"Wizard of OZ\")");
end func;