Answer the question
In order to leave comments, you need to log in
How to sort in descending order?
I have data
type Unit struct {
Attack int32
Defense int32
Keep int64
Price int64
}
type Units map[string]Unit
Answer the question
In order to leave comments, you need to log in
The correct answer is that map elements are not sorted. The keys are always output in random order.
If you need to sort by values, then you need to use slices.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question