Ask coding questions

← Back to all posts
Is there a way to get the highest value stored in the repl database?
DylanDale

I want to make a leaderboard for my game that displays people with the highest number of coins.

Answered by CodingElf66 [earned 5 cycles]
View Answer
Voters
DylanDale
Comments
hotnewtop
CodingElf66

Yes, it is possible.

Assuming that the key is the username, and db[key] is their highscore, then this would sort it in order.

Now you can mark it as answered, thank you!

MrVoo

Make a copy of the leader board, get the highest value and move it to a separate list. Repeat until the copy is empty, and the separate list has the scores in order.

IntellectualGuy

When someone tries to take a look at the score, then you could get all of the values of the database and rearrange them based on score.