Unexpected Symbol 'break'

Hi I’m new in programming and there is this Unexpected Symbol ‘break’ that doesn’t want get out no matter how many posts I read and tweaks I do. Here it is:

	void Update () 
	{
		switch (state)

		{
		case 0:
			if (GUI.Button (new Rect (10, 10, 100, 30), "Connect"))
			Connect ();
	break;

		case 1:
			(GUI.Label (new Rect (10, 10, 100, 30), "Connected"))
	break;   <----------------<-------------------<-----------------------<---------------------
		}
	}

You are missing a semicolon in case 1. Note that the extra parenthesis is unnecessary for this line GUI.Label (new Rect (10, 10, 100, 30), "Connected");. You could make an enum instead of setting a “magic” integer number as state.

    public GameObject[] Spawns;
    private enum ConnectionState
    {
        waitingToConnect,
        connecting,
        connected
    }
    private ConnectionState connectionState = ConnectionState.waitingToConnect;
    public bool isATestBool;

    // OnGUI is called for rendering and handling GUI events
    void OnGUI()
    {
        switch (connectionState)
        {
            case ConnectionState.waitingToConnect:
                if (GUI.Button(new Rect(10, 10, 100, 30), "Connect"))
                    connectionState = ConnectionState.connecting;
                break;
            case ConnectionState.connecting:
                GUI.Label(new Rect(10, 10, 100, 30), "Connecting");
                TryToConnect();
                break;
            case ConnectionState.connected:
                GUI.Label(new Rect(10, 10, 100, 30), "Connected");
                //Invoke("TestReset", 3f);
                break;
            default:
                Debug.LogErrorFormat("connectionState not properly set in class:{0}", this);
                break;
        }
    }

    private void TryToConnect()
    {
        // TODO Replace isTestBool with a photon callback that confirms the connection
        if (isATestBool )
        {
            // Connection succeeded
            connectionState = ConnectionState.connected;
        }
        else
        {
            // Still waiting for connection to complete
            connectionState = ConnectionState.connecting;
        }
    }

    //private void TestReset()
    //{
    //    connectionState = ConnectionState.waitingToConnect;
    //}

I left some test code in it that you could experiment with. Note the TODO comment. You should get a confirmation from photon that you got a connection before you display it. isATestBool should be replaced by your own bool check.

What you are trying to do is not breaking the line which is in your second case you should use ; or semicolon to break a line if you are done with it and please use Curly brackets after all if statements it is good practice

Here i have edited it

  void Update() 
     {
         switch (state)
 
         {
         case 0:
             if (GUI.Button (new Rect (10, 10, 100, 30), "Connect"))
             {
             Connect ();
             }
     break;
 
         case 1:
           GUI.Label (new Rect (10, 10, 100, 30), "Connected");

     break;
         }
     }