Using raycast and collider to increase int

I looked at the raycast documentation script on the unity website to try and understand raycasts. I was using the script and was wondering how i can change it to make the raycast know if it hit a certain collider then increase an int by 1 if it hit the correct collider.
(the code sample button isnt working properly so i have to insert the code here)

//

//

using UnityEngine;
using System.Collections;

public class Raycast : MonoBehaviour {

public float RayDistance = 5;

void Update() {

	if (Input.GetButtonDown ("Fire1")) 
	{
		Vector3 fwd = transform.TransformDirection (Vector3.forward);
		if (Physics.Raycast (transform.position, fwd, RayDistance))
			print ("There is something in front of the object!");
	} 	
}

}

You need to assign the result of the raycast into a RaycastHit, there you have a reference to the collider that was hit, and from it you can get any component of that object and check it’s tag, name, or anything else you want.

RaycastHit hitInfo;
if (Physics.Raycast (transform.position, fwd, out hitInfo, RayDistance)) {
   GameObject hitObject = hitInfo.collider.gameObject;
   if (hitObject.tag == "sometag") {
       // Do something
   }
}