Icon+Unicon/Intro: Difference between revisions

Content added Content deleted
Line 70: Line 70:
In SNOBOL an undefined value defaults to the null string "" and the null string is coerced into a zero 0 if needed for math. Thus the surprise output above is 2 and not 5 as expected. While on close inspection the error is apparent, you can see how this could be missed in a large program predominated by global variables.
In SNOBOL an undefined value defaults to the null string "" and the null string is coerced into a zero 0 if needed for math. Thus the surprise output above is 2 and not 5 as expected. While on close inspection the error is apparent, you can see how this could be missed in a large program predominated by global variables.


In Icon/Unicon &null is not coerced and so:
In Icon/Unicon &null is not coerced by operators and so:
<lang Icon> write( 2 + &null ) # run time error 101
<lang Icon> write( 2 + &null ) # run time error 101
write( "abc" || &null ) # run time error 103
write( "abc" || &null ) # run time error 103