0
Can C# have statement in condition
How can i use sth like this: if (int x = SomeMethodReturnsInt() != 1) { //play with x } instead of int x = SomeMethodReturnsInt(); if (x != 1) { } Is it possible?
1 Answer
+ 1
It is possible to have a statement in a condition.
It is not allowed to declare a new variabele in a if statement.
https://code.sololearn.com/cHEYbt5PHwWO/?ref=app