RosettaCodeData/Task/Sort-an-array-of-composite-structures/Elena/sort-an-array-of-composite-structures.elena
2024-03-06 22:25:12 -08:00

20 lines
558 B
Text

import system'routines;
import extensions;
public program()
{
var elements := new object[]{
KeyValue.new("Krypton", 83.798r),
KeyValue.new("Beryllium", 9.012182r),
KeyValue.new("Silicon", 28.0855r),
KeyValue.new("Cobalt", 58.933195r),
KeyValue.new("Selenium", 78.96r),
KeyValue.new("Germanium", 72.64r)};
var sorted := elements.sort::(former,later => former.Key < later.Key );
sorted.forEach::(element)
{
console.printLine(element.Key," - ",element)
}
}