Unity – Switch

Switch Statement:

#pragma strict

var intelligence : int = 5;
    
    
function Greet()
{
    switch (intelligence)
    {
    case 5:
        print ("Why hello there good sir! Let me teach you about Trigonometry!");
        break;
    case 4:
        print ("Hello and good day!");
        break;
    case 3:
        print ("Whadya want?");
        break;
    case 2:
        print ("Grog SMASH!");
        break;
    case 1:
        print ("Ulg, glib, Pblblblblb");
        break;
    default:
        print ("Incorrect intelligence level.");
        break;
    }
}

NOTICE:
‘switch (intelligence)’ -> get the valuie from ‘var intelligence : int = 5’