int a, b;

if (a = 3) { } <- not allowed: Error: assignment cannot be used as a condition, perhaps == was meant?

b = a = 3 ? 4 : 5   <- allowed


I believe the second case should be disallowed also. It seems illogical, that the first one isn't allowed, but the second one is, when the second one is also 'assignment used as condition'. Is there a valid usecase for such assignment?

Reply via email to