Bracket is a small thing, easy to find; Visual Studio will show the matching brackets (did you see it)…
But look at what are you doing!
Why using two conditions if one is the opposite to another. And this is not a small mistake, this is wrong way of thinking. Now, imagine you replace 40 with 42 (believe me, no constant stay a constant for long). You can easily change it only in one case and break your code. So, no immediate constants, ever! (The literal 40 in your code is called immediate constant, it goes right into the code after compilation and JIT.)
Keep all constants in the same place declared as constants explicitly.
In other cases, they should not be constants but variables, objects in resources or some configuration files.
Never assume any constant to be of the same value forever.
The loop at the end is never finished. How can it? If
the code will get into the loop, because this is a loop condition, it remains in the loop forever, because condition remains true, because
value is never modified thereafter.—SA