Alex.
I have found that if you say this: contant x = 4 on mouseup answer x end mouseup You get a "4" But, if you place the contstant statement below the handler, you geet "x". Is this what tripped you up? Craig Newman -----Original Message----- From: Alex Tweedly <a...@tweedly.net> To: How to use LiveCode <use-livecode@lists.runrev.com> Sent: Mon, May 28, 2012 7:02 pm Subject: Constant statement limitations. 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. _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode