[SOLVED] Can you help me fix the Parsing Error CS8025

I have fixed a few errors from what ive learnt so far in this course but now I’m stuck again, help is needed. this is my code can you fix it? much appreciated. I want to continue my coding experience but this is throwing me off and I really am enjoying this.

using UnityEngine;
using System.Collections;

public class NumberWizard : MonoBehaviour {

// Use this for initialization
void Start () {
	print ("Welcome to Number Wizard");
	print ("Pick a Number in Your Head But DON'T TELL me!");
	
	int max = 1000;
	int min = 1;
	
	print ("The Highest Number You Can Pick Is "   + max);
	print ("The Lowest Number You Can Pick Is "   + min);
	
	print ("Is Your Number Higher Or Lower Than 500?");
	print ("Up Arrow = Higher Down Arrow = Lower And Backspace = Equal.");
}

// Update is called once per frame
void Update() {
	if (Input.GetKeyDown(KeyCode.UpArrow))
	print("Up arrow pressed. ");

Hi Angelo,
There are two closing braces missing at the end of your script (one to close the Update() function, and one to close the NumberWizard class). This could be the cause of your parsing error.

1 Like

this is my new code and now it says the same parsing error and the unexpected symbol is ‘if’

// Update is called once per frame
void Update() {
	if (Input.GetKeyDown(KeyCode.UpArrow))
		print ("Up arrow pressed.")
	if (Input.GetKeyDown(KeyCode.DownArrow))
		print ("Down arrow pressed.")
	if (Input.GetKeyDown(KeyCode.Return))
		print ("Return pressed.")}

can you re-write the code with the opening and closing brackets for me please because I’m lost and have tried all I know so far, at least if I had it re-written I would know where I went wrong and could compare it. thanks.

Hi Angelo,
The problem here is that the print statements don’t have a semicolon at the end. For the opening and closing braces, I’d suggest placing them on the same indentation level to make it clear which brace closes which, like so:

using UnityEngine;
using System.Collections;

public class NumberWizard : MonoBehaviour 
{
    // Use this for initialization
    void Start () 
    {
	    print ("Welcome to Number Wizard");
	    print ("Pick a Number in Your Head But DON'T TELL me!");
	
	    int max = 1000;
	    int min = 1;
	
	    print ("The Highest Number You Can Pick Is "   + max);
	    print ("The Lowest Number You Can Pick Is "   + min);
	
	    print ("Is Your Number Higher Or Lower Than 500?");
	    print ("Up Arrow = Higher Down Arrow = Lower And Backspace = Equal.");
    }

    // Update is called once per frame
    void Update() 
    {
	    if (Input.GetKeyDown(KeyCode.UpArrow))
		    print ("Up arrow pressed.");
	    if (Input.GetKeyDown(KeyCode.DownArrow))
		    print ("Down arrow pressed.");
	    if (Input.GetKeyDown(KeyCode.Return))
		    print ("Return pressed.");
    }
}

[quote=“Sebastian_Martens, post:4, topic:44538”]

the code you gave works because I copied and pasted it but I still am not sure I understand how the brackets are used and when they should be used also this is what error I currently get but thanks for getting rid of the parsing error and the if unexpected symbol error but heres the screenshot…

Do you have a controller plugged in, or perhaps a bluetooth adapter plugged in for a controller?

nope but its working now thanks to all that helped. :slight_smile:

1 Like

Privacy & Terms