1. FW: can you check for assignment?
Whoops, I goofed on one of my examples! Here's the corrected boolean flag
example:
-- Example: using a boolean flag along with our variable
constant TRUE = 1, FALSE = 0
type boolean(integer x)
return x = TRUE or x = FALSE
end type
integer last_time
boolean last_time_flag
last_time_flag = FALSE
procedure get_this(integer info)
if last_time_flag = FALSE then
do_that -- CORRECTION!
elsif info = last_time then
do_this
else
do_that
end if
last_time = info
last_time_flag = TRUE
end procedure
--------
POTENTIALLY CONFUSING ADDENDUM:
In Euphoria 2.1, with short-circuiting of "if" and "while" conditions, you
can code the "if" statement above like this instead:
if last_time_flag = FALSE or info != last_time then
do_that
else
do_this
end if
If the "last_time_flag = FALSE" is true, Euphoria will automatically go to
"do_that" and ignore the "info != last_time" clause. Thus, the "if"
statement will not crash the program if "last_time" has not been assigned a
value yet. See "Short-Circuit Evaluation" in REFMAN.DOC, under 2.5.4 ("while
statement"), for more information on this.
Hope this helps,
Gabriel Boehme