[–] lutusp 12y ago ↗ An interesting exposition, one that avoids mentioning that a person who tries to assign a value to "undefined" needs psychological help. [–] joshuacc 12y ago ↗ While this is undoubtedly true, there is also the case of accidental assignment.For example:if (undefined = "something") {}This is merely a case of stupidity, not madness. :-) [–] lutusp 12y ago ↗ > if (undefined = "something") {}Seasoned programmers avoid the possibility of inadvertent assignment by reversing the order of the arguments as a matter of habit:if ("something" = undefined) {}If (42 = secret_of_the_universe) {}Also, they try to avoid languages that use "=" as an equality test as well as an assignment operator. Early BASIC was infamous for this.> This is merely a case of stupidity, not madness.Must agree there. :)
[–] joshuacc 12y ago ↗ While this is undoubtedly true, there is also the case of accidental assignment.For example:if (undefined = "something") {}This is merely a case of stupidity, not madness. :-) [–] lutusp 12y ago ↗ > if (undefined = "something") {}Seasoned programmers avoid the possibility of inadvertent assignment by reversing the order of the arguments as a matter of habit:if ("something" = undefined) {}If (42 = secret_of_the_universe) {}Also, they try to avoid languages that use "=" as an equality test as well as an assignment operator. Early BASIC was infamous for this.> This is merely a case of stupidity, not madness.Must agree there. :)
[–] lutusp 12y ago ↗ > if (undefined = "something") {}Seasoned programmers avoid the possibility of inadvertent assignment by reversing the order of the arguments as a matter of habit:if ("something" = undefined) {}If (42 = secret_of_the_universe) {}Also, they try to avoid languages that use "=" as an equality test as well as an assignment operator. Early BASIC was infamous for this.> This is merely a case of stupidity, not madness.Must agree there. :)
3 comments
[ 2.5 ms ] story [ 21.0 ms ] threadFor example:
if (undefined = "something") {}
This is merely a case of stupidity, not madness. :-)
Seasoned programmers avoid the possibility of inadvertent assignment by reversing the order of the arguments as a matter of habit:
if ("something" = undefined) {}
If (42 = secret_of_the_universe) {}
Also, they try to avoid languages that use "=" as an equality test as well as an assignment operator. Early BASIC was infamous for this.
> This is merely a case of stupidity, not madness.
Must agree there. :)