The contextual keyword `var' may only appear within a local variable declaration

Trying to change this variable from javascript to c#. I’m getting an error saying
“The contextual keyword `var’ may only appear within a local variable declaration”

static var PlayerCoin = 0;

rest of script is as follows

using UnityEngine;
using System.Collections;

public class CollectCoin : MonoBehaviour {
	
 	static var PlayerCoin = 0;
	public GUISkin CoinDisplay;
	public Rect CoinRect;

void OnTriggerEnter2D(Collider2D coin)
{
	if(coin.tag == "Coin")
	{
		PlayerCoin++;
		print(PlayerCoin);
		Destroy(coin.gameObject);
	}
}

void OnGUI()
{
	GUI.skin = CoinDisplay;
	GUI.Label(CoinRect, PlayerCoin, GUI.skin.GetStyle("Coin"));
}
}

C# does have a var keyword, used to make the compiler “guess” a variable type. It works in about the same way as JavaScript’s:

//myColor has type "Color"
var myColor = Color.black;

The main limit is that C# only lets you use var for local variables (inside a function). Your class members must have explicit types.

In your case, it looks like you want this:

static int PlayerCoin = 0;