Player Prefs question...

Hello. I want to use playerprefs for saving/displaying the player's high score. How can I make it so that only the largest score is saved? Would it be something like this:

if (score>PlayerPrefs.GetInt("Player Score") {PlayerPrefs.SetInt("Player Score", score);}


var highestScore = 0;
var score = 0;

function Update ()
    //I recomend putting this in its own function and only calling it at the end of the game...
    if(score > highestScore)
        highestScore = score;


Highest score will save then, and you can just show that on the GUI you need it to...

Hope this is kind of what you want =).