problems with boolean else

Could anyone explain?
I can not use it, several (else) inside the if
is giving this error

Unexpected symbol `else’

    void moviment(bool Player)
    {
        if (Player)
        {
            blablabla
        }
        else
        {
            blablabla
        }
        else
        {
            blablabla
        }

Well, else else doesn’t make sense. When would you expect to hit the second else?

I would use this, to have access to the second and the others

    public void previous()
    {
        moviment(true);
    }

    public void next()
    {
        moviment(false);
    }

It should be used something like this.

    void moviment(bool Player)
    {
        if (Player)
        {
            blablabla
        }
        else if (Other Condition)
        {
            blablabla
        }
        else
        {
            blablabla
        }
   }

did not work, if I put another condition not active neither (else if) or another after it

What is it you are trying to do here?
Having multiple else conditions on the same if condition does not make any logical sense.
This is a binary sequence. Either one block or the other block of code will run depending on whether the condition is true or false.

change something like, position, text and images.
then it means that (boolean else) only works with only 1 else

Show your code, so we can see what you did wrong when you tried my suggestion.

the idea that I’m trying is this way

    public Text texto;
    public GameObject object;
    public Image image;

    public void previous()
    {
        moviment(true);
    }

    public void next()
    {
        moviment(false);
    }

    void moviment(bool Player)
    {
        if (Player)
        {
            texto.text = "1";
            object.transform.position = new Vector3(0, 0, 0);
            image.rectTransform.sizeDelta = new Vector2(100, 100);
        }
        else
        {
            texto.text = "2";
            object.transform.position = new Vector3(10, 0, 0);
            image.rectTransform.sizeDelta = new Vector2(100, 120);
        }
        else
        {
            texto.text = "3";
            object.transform.position = new Vector3(20, 0, 0);
            image.rectTransform.sizeDelta = new Vector2(100, 130);
        }

You need to read my first post properly, the 2nd else needs to be ‘else if(some condition)’. That being said, logically what you are trying to do is wrong anyway, because player is a bool, which can only have two states (true or false), therefore, your if/else statement can only use it for two conditions, not three.

2 Likes