(Help) Scripting Error: NullReferenceException: Object reference not set to an instance of an object

I am in the process of swapping the game text just outputing to the console to text showing in a unity text box so not all the scripting is complete. I was just testing what I have done. I am very new to coding so I apologize in advance if it is something really simple I messed up. I am betting it is.
Unity is giving me this error.

NullReferenceException: Object reference not set to an instance of an object
NumberWizard.startgame () (at Assets/NumberWizard.cs:36)
NumberWizard.Update () (at Assets/NumberWizard.cs:23)

When I try to run this script. I dont see the issue on line 36 and 23

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class NumberWizard : MonoBehaviour {

// Use this for initialization
public Text text;
public enum States {startgame, firstguess, nextguess, win}
public States myState;
int max;
int min;
int guess;

void Start () {
myState = States.startgame;

}

// Update is called once per frame
void Update () {
23 if (myState == States.startgame) {startgame();}
else if (myState == States.firstguess) {firstguess();}
else if (myState == States.nextguess) {nextguess();}
else if (myState == States.win) {win();}

}

void startgame() {

min = 1;
max = 1000;
guess = Random.Range(min,max);

36 text.text = “=======================================================================\n” +
“Welcome to Number Wizard\n\n” +
“Pick a number in your head, but don’t tell me.\n\n” +

"Number must be between " + min +
"and " + max +
“.\n\n” +

“Press Enter when you have your number selected.”;
max = max + 1;
if (Input.GetKeyDown(KeyCode.Return)) {myState = States.firstguess;}

}

void firstguess () {

print ("Is the number " + guess);
print (“Type Up Arrow for higher, Down Arrow for lower, and Enter for equals.”);
if (Input.GetKeyDown(KeyCode.UpArrow)) {
min = guess;
myState = States.nextguess;
}
else if (Input.GetKeyDown(KeyCode.DownArrow)) {
max = guess;
myState = States.nextguess;
}
else if (Input.GetKeyDown(KeyCode.Return)) {
myState = States.win;
}

}

void nextguess () {

guess = (max + min) / 2;
print ("Is the number " + guess);
print (“Type Up Arrow for higher, Down Arrow for lower, and Enter for equals.”);
if (Input.GetKeyDown(KeyCode.UpArrow)) {
min = guess;
myState = States.nextguess;
}
else if (Input.GetKeyDown(KeyCode.DownArrow)) {
max = guess;
myState = States.nextguess;
}
else if (Input.GetKeyDown(KeyCode.Return)) {
myState = States.win;
}

}

void win (){

print ("Your number was " + guess);
print (“I win!!”);
}

Use code tags - it will let us see line numbers.

As for your problem, your text reference must be null. Make sure you have assigned it in the Inspector.

Ok so I am an idiot. I had to assign the text box to the text the script was out putting.

That was it. thanks. I knew it was something stupid

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class NumberWizard : MonoBehaviour {

// Use this for initialization
public Text text;
public enum States {startgame, firstguess, nextguess, win}
public States myState;
int max;
int min;
int guess;


void Start () {
myState = States.startgame;

}

// Update is called once per frame
void Update () {
if (myState == States.startgame) {startgame();}
else if (myState == States.firstguess) {firstguess();}
else if (myState == States.nextguess) {nextguess();}
else if (myState == States.win) {win();}

} 

void startgame() {

min = 1;
max = 1000;
guess = Random.Range(min,max);

text.text = "=======================================================================\n" +
"Welcome to Number Wizard\n\n" +
"Pick a number in your head, but don't tell me.\n\n" +

"Number must be between " + min +
"and " + max +
".\n\n" +

"Press Enter when you have your number selected.";
max = max + 1;
if (Input.GetKeyDown(KeyCode.Return)) {myState = States.firstguess;}

}



void firstguess () {

print ("Is the number " + guess);
print ("Type Up Arrow for higher, Down Arrow for lower, and Enter for equals.");
if (Input.GetKeyDown(KeyCode.UpArrow)) {
min = guess;
myState = States.nextguess;
} 
else if (Input.GetKeyDown(KeyCode.DownArrow)) {
max = guess;
myState = States.nextguess;
} 
else if (Input.GetKeyDown(KeyCode.Return)) {
myState = States.win;
}

}


void nextguess () {

guess = (max + min) / 2;
print ("Is the number " + guess); 
print ("Type Up Arrow for higher, Down Arrow for lower, and Enter for equals.");
if (Input.GetKeyDown(KeyCode.UpArrow)) {
min = guess;
myState = States.nextguess;
} 
else if (Input.GetKeyDown(KeyCode.DownArrow)) {
max = guess;
myState = States.nextguess;
} 
else if (Input.GetKeyDown(KeyCode.Return)) {
myState = States.win;
}

}

void win (){

print ("Your number was " + guess);
print ("I win!!");
}
}