constant | |||||||
Type | command | ||||||
Dictionary | LCS | ||||||
Library | LiveCode Script | ||||||
Syntax |
| ||||||
Summary | |||||||
Introduced | 1.0 | ||||||
OS | mac, windows, linux, ios, android | ||||||
Platforms | desktop, server, mobile | ||||||
Parameters |
| ||||||
Example |
| ||||||
Related | Property: script Constant: watch, false, slash, comma, plus, null, pi, iBeam, colon, three, formfeed, help, five, zero, seven, eight, CRLF, quote, empty, space, arrow, six, ten, four, two Command: constant, local Function: constantNames Control Structure: function Glossary: LiveCode, value, handler, string, statement, constant, keyword, command | ||||||
Description | Use the constant command to assign an unchanging value to a keyword. Constants can be numbers, characters, logical values, or strings. A constant cannot be defined as an array, only as a single value.
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. Once you have defined a constant, you cannot redefine it in the same handler; doing so causes an execution error. You can use the constant command to redefine LiveCode's built-in constants within a script or handler, but doing so makes your code harder to read and maintain. To find out whether a word is already defined as a built-in constant, use the constantNames function.
| ||||||
Tags | properties |