How do I use the isGrounded command?

Ive seen a couple of ways other people have done it but I can’t get it to work. I’m really new to code and this is just frustrating me.

using UnityEngine;
using System.Collections;

public class ControllerPlayerOne : MonoBehaviour {

	public float speed;
	public float turnSpeed;
	private float moveInput = 10;
	private Rigidbody Tank;

	void Awake () 
	{
		Tank = GetComponent <Rigidbody>();
	}
		
	void Update () 
	{
		CharacterController controller = GetComponent<CharacterController>();
		if (controller.isGrounded) 
		{
			print ("We are grounded");
			if (Input.GetKey (KeyCode.W))
				Tank.AddRelativeForce (0f, 0f, moveInput * speed);

			if (Input.GetKey (KeyCode.S))
				Tank.AddRelativeForce (0f, 0f, -moveInput * speed);
			
			if (Input.GetKey (KeyCode.A))
				transform.Rotate (Vector3.up, -turnSpeed * Time.deltaTime);

			if (Input.GetKey (KeyCode.D))
				transform.Rotate (Vector3.up, turnSpeed * Time.deltaTime);
		}

	}
}

The isGrounded is not a command, but rather a bool, meaning it will be either TRUE or FALSE. In the code you provided, the Update method (runs every frame) is checking to see if the controller isGrounded with this line here:

 if (controller.isGrounded) 

The above code is the same as this code below, which is sometimes easier for new programmers to understand.

 if (controller.isGrounded == true) 

What the script you provided is doing is only accepting input to rotate or add force to the character controller based off the keys W, S, A, and D, while the controller is grounded. If you wanted to do something when the isGround bool is false, you would do one of these:

 if (!controller.isGrounded) 

 if (controller.isGrounded == false) 

As far as the frustration goes, don’t worry, that is normal. Take a break, do something fun, and come back recharged. Being new to programming, I would highly recommend looking into some learning material, such as Unity’s own scripting tutorials, which are fantastic for new Unity developers.

So you’re saying that the code should work? and thanks for the tip bits of information and the help generally.