On Fri, Jan 03, 2003 at 12:20:02AM +0100, Mirar @ Pike developers forum wrote:
Don't forget, | > str/-5; | "45123", | > str/-5.0; | "123", | "45123",
cool! :-)
lets get on with it: (gotta do something while i attempt to get the pike 7.4 debian packages to compile on woody)
Establishing a Default Value //----------------------------- // use b if b is true, else c a = b || c;
// set x to y unless x is already true if(!x) x=y;
// use b if b is defined, else c // an undefined variable would be a compile time error. a= b?b:c; foo = bar || "DEFAULT VALUE"; dir = argv[0] || "/tmp"; dir = arrayp(ARGV) ? ARGV[0] : "/tmp"; count[shell||"/bin/sh"]++;
user = getenv("USER") || getenv("LOGNAME") || getpwuid(getuid())[0] || "Unknown uid number "+getuid();
if(!starting_point) starting_point = "Greenwich";
if(!sizeof(a)) a=b; // copy only if empty a=(sizeof(b)?b:c); // assign b if nonempty, else c
greetings, martin.