-1

I can't read the condition in the while ... it should start with: until the i is equal to..., and then I don't understand.

    private int[] array1;
    private int[] array2;
    private int index;
    private bool scale;

    for (int i = 0; i <= 100; i++)
    {
        while (i == (scale ? array1[index] : array1[index]))
        {

        }
    }

How should I read the while condition completely?

Thanks in advance.

Prino
  • 19
  • 4
  • Does this answer your question? [Benefits of using the conditional ?: (ternary) operator](https://stackoverflow.com/questions/3312786/benefits-of-using-the-conditional-ternary-operator) – Guy Feb 02 '20 at 08:53
  • https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/conditional-operator – Guy Feb 02 '20 at 08:54
  • 2
    This doesn't make sense `scale ? array1[index] : array1[index]`, you get the same `array1[index]` value when `scale` is `true` or `false`. Your question is very unclear, what do you wan't to achieve using this code – Pavel Anikhouski Feb 02 '20 at 08:54
  • maybe you'll need to update your ternary operator to `scale ? array1[index] : array2[index]` – Pavel Anikhouski Feb 02 '20 at 08:57
  • Ahd it's still a constant. If the while-loop is not filled with code, it's very likely endless, so the program would freeze. – Holger Feb 02 '20 at 09:48

1 Answers1

0

? mean is true or false.

scale is true -> send array1[index]

scale is false -> send array2[index]