string conversion of INDEF-valued real
Jason Quinn wrote on Jun 24, 2008
real tmpx=INDEF
print("The value is "//str(tmpx))
returns: INDEF
expect: The value is INDEF
print("The value is "//str(tmpx))
returns: INDEF
expect: The value is INDEF
Mike Fitzpatrick wrote on Jun 24, 2008
The '//' is a binary operator and as a rule expressions involving an INDEF operand are not allowed, so what you're seeing is that the result of concatenating a string with an INDEF is itself an INDEF value. In v2.14 you can use the isindef() builtin to test for this, e.g.
Alternatively, use printf() instead:
Cheers,
-Mike
if (isindef (foo)) {
print ("value is INDEF")
} else {
print ("value is " // foo)
}
Alternatively, use printf() instead:
ecl> x = INDEF
ecl> printf ("value is %s\n\n", str(x))
value is INDEF
Cheers,
-Mike
Last post on Jun 24, 2008