hallo, can someone help me wtih this. I am getting Left-hand side of an assignment must be a variable, property or an indexer.

hallo, can someone help me wtih this. I am getting Left-hand side of an assignment must be a variable, property or an indexer.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace Opgave_3 { class Program { static void Main(string args) { int stukjes = new int[9] { 2, 4, 3, 1, 5, 6, 7, 8, -1 };

    int legePos = 8;
    TekenPuzzel(stukjes);

    int offset;

    while (true)
    {
        ConsoleKeyInfo invoer = Console.ReadKey();
        switch (invoer.Key)
        {
            case ConsoleKey.UpArrow:
                offset = 3;
                break;

            case ConsoleKey.DownArrow:
                 offset = -3;
                break;

            case ConsoleKey.LeftArrow:
                offset = 3;
                break;

            case ConsoleKey.RightArrow:
                offset = 3;
                break;

            default:
                offset = 0;
                break;
        }

        int legePos2 = legePos + offset;
        int zelfdeRij = ((legePos / 3) = (legePos2 / 3));
        int zelfdeKolom = ((legePos % 3) = (legePos2 % 2));

        if (zelfdeRij != zelfdeKolom && legePos2 >= 0 && legePos2 < stukjes.Length)
        {
        stukjes[legePos] = stukjes[legePos2];
        stukjes[legePos2] = -1;
        legePos = legePos2;
        TekenPuzzel(stukjes);
        }
    }

}
static void TekenPuzzel(int[] stukjes)
{
    Console.Clear();
    int i = 0;
    int getal;

    while (i < stukjes.Length)
    {
        getal = stukjes*;*

if (getal > 0)
{
Console.Write(getal);
}
else
{
Console.Write(“”);
}
if((i + 1) % 3 ==0)
{
Console.ReadLine();
}
}
Console.ReadLine();
}
}
}

The error is caused by these two lines.

int zelfdeRij = ((legePos / 3) = (legePos2 / 3));
int zelfdeKolom = ((legePos % 3) = (legePos2 % 2));

They don’t even make sense.

You are trying to set (legePos / 3) equal to (legePos2 / 3). But (legePos / 3) is not a variable. legePos is a variable, so you can do legePos = something. That’s what the error is trying to say.

I honestly have no clue what this code is supposed to do, so I can’t tell you what you’d need to change it to.

Also, you’ve tagged your post as c++ when it is clearly C# and it doesn’t appear to have anything to do with Unity.

this lines are wrong

int zelfdeRij = ((legePos / 3) = (legePos2 / 3));
int zelfdeKolom = ((legePos % 3) = (legePos2 % 2));