Start Animation in code is not working

Hello, can you help me ?
My animation isn’t starting from my code:

coin = CoinControll.Coin;
var anim: Animation;

anim = GetComponent.<Animation>();


if (coin>0){
GetComponent.<Animation>().Play();
}

[43538-beztytułu.png|43538]

What is wrong ?

Just pass the animation name as a string as a parameter.

anim.Play("dooropen");