In many languages assignments are legal in conditions. I never understood the reason behind this. Why would you write:
if (var1 = var2) {
...
}
instead of:
var1 = var2;
if (var1) {
...
}
Question&Answers:osIn many languages assignments are legal in conditions. I never understood the reason behind this. Why would you write:
if (var1 = var2) {
...
}
instead of:
var1 = var2;
if (var1) {
...
}
Question&Answers:os