17 lines
631 B
Text
17 lines
631 B
Text
lst = Pair[Pair("gold", "shiny"),
|
|
Pair("neon", "inert"),
|
|
Pair("sulphur", "yellow"),
|
|
Pair("iron", "magnetic"),
|
|
Pair("zebra", "striped"),
|
|
Pair("star", "brilliant"),
|
|
Pair("apple", "tasty"),
|
|
Pair("ruby", "red"),
|
|
Pair("dice", "random"),
|
|
Pair("coffee", "stimulating"),
|
|
Pair("book", "interesting")]
|
|
|
|
println("The original list: \n - ", join(lst, "\n - "))
|
|
sort!(lst; by=first)
|
|
println("\nThe list, sorted by name: \n - ", join(lst, "\n - "))
|
|
sort!(lst; by=last)
|
|
println("\nThe list, sorted by value: \n - ", join(lst, "\n - "))
|