You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case temp is declared already, but may never have been assigned. The if-check prevents using it, if it's not been assigned, so this compile warning may be unnecessary?
thanks
The text was updated successfully, but these errors were encountered:
I understand your point, but most of the time "if" statements are used to check a variable's value, not to see whether it was assigned. This warning is useful because more often than not (at least in my experience and in most professional code I've seen) that situation is indeed not the programmer's intention.
As a side note, since "temp" is only defined inside that if statement, you can merge your two conditionals (unless path.normalize() can return a falsy value, in which case you can just assign a falsy value to temp in its declaration or in the else branch anyways).
Please see this screenshot:
In this case
temp
is declared already, but may never have been assigned. The if-check prevents using it, if it's not been assigned, so this compile warning may be unnecessary?thanks
The text was updated successfully, but these errors were encountered: