in reply to Defensive Programming

Something I always thought was cool but never got in the habit of doing is putting constants on the left side of the == comparison. If the character goblins grab one of your =, you'll get a compile error instead of an unwanted assignment.

if (42 = $num) { print "It's 42."; }

YuckFo

Replies are listed 'Best First'.
Re: Re: Defensive Programming
by IlyaM (Parson) on Jan 15, 2002 at 18:33 UTC