[REBOL] Re: Seems like a View 2.7.6 "if" statement issue ......???
From: anton::wilddsl::net::au at: 8-Oct-2008 17:59
Hi John,
Gregg Irwin wrote:
> Hi John,
> JD> if ((substr rec1 (y + j) + 2054 1) > " ") [ <------------- error here
> JD> Error msg. from 2.7.6:
>
> JD> ** Script Error: Expected one of: binary! - not: string!
> JD> ** Near: (substr rec1 (y + j) + 2054 1) > " "
>
> More context would help, or a standalone example of the problem.
>
> What is the source for SUBSTR, and what are the actual contents of
> rec1? It looks like rec1 is a binary value.
>
> -- Gregg
Gregg is right, before jumping to conclusions and posting
an expression with a couple of unknowns in it, you should
find out what the actual values are when the expression is
evaluated. You can do this in two ways;
1) print the values on the line just before.
2) PROBE the values within the line.
eg: 1)
print y + j
?? rec1
probe substr rec1 (y + j) + 2054 1
if ((substr rec1 (y + j) + 2054 1) > " ") [
eg: 2)
if ((probe substr probe rec1 probe (y + j) + 2054 1) > " ") [
Where the error occurs should now be much clearer.
Using PROBE within the line is a bit safer than printing
before the line, when evaluating functions such as your
SUBSTR, because, should the function have a side effect,
the second evaluation may return a different result, and
so what is printed will be different to what causes the
error.
Regards,
Anton.