Player jumping issue

I am new to c# and Unity and i am experimenting making a game. Everything is going great but i am having an issue with jumping. Here is my code:

if (Input.GetKeyDown (“space”))

		a.AddForce (0, jump, 0);

jump is a public float and a is the player’s public Rigidbody
and some times it uses the public float jump but other times the player jumps a lot higher.
Thanks in advance.

you might have a look at some tutorials…

but this should get you going

 using UnityEngine;
 using System.Collections;
     public class PlayerController : MonoBehaviour {
         public Vector3 jump;
         public float jumpForce = 2.0f;
         public bool isGrounded;
         Rigidbody rb;
         void Start(){
             rb = GetComponent<Rigidbody>();
             jump = new Vector3(0.0f, 2.0f, 0.0f);
         void OnCollisionStay()
             isGrounded = true;
         void Update(){
             if(Input.GetKeyDown(KeyCode.Space) && isGrounded){
                 rb.AddForce(jump * jumpForce, ForceMode.Impulse);
                 isGrounded = false;

i found a way to fix the problem anyway thanks @dan_wipf

if(Input.GetKeyDown(KeyCode.Space) && isGrounded)

		a.velocity = new Vector3 (0f, jumpforce, 0f);
		isGrounded = false;