Constant statement limitations.
Alex Tweedly
alex at tweedly.net
Mon May 28 19:00:39 EDT 2012
The dictionary entry for constant says:
>
> If you place the constant statement in a handler, you can use the
> constant anywhere in the handler. If you place the constant statement
> in a script outside any handler, you can use the constant anywhere in
> the handlers of that script.
NB - "can use the constant anywhere *in the handlers* of that script".
That was a reasonable limitation in traditional Livecode - but seems
less reasonable in the context of revserver. It is (I think) common
practice, and it's certainly possible, to have quite a lot of the
"top-level" code be in the script itself, perhaps with html intermingled
with it, i.e. not be in a handler.
So the obvious, simple code fragment
constant K = 3.14159
put $_POST["diameter"] * K
doesn't give the expected result :-)
Anyone see any reason why constants *shouldn't* be usable outside handlers ?
Thanks
-- Alex.
More information about the use-livecode
mailing list