if() statement allows a rule to be applied conditionally on the basis of the content of a variable store.
if(storeName comparison store2) ... > ... if(storeName comparison constant) ... > ...
- The variable store to test.
!=, for equal and not equal, respectively.
if() statement allows any rule to be applied conditionally, depending on the content of store
storeName, which can be defined either
during keyboard configuration or dynamically by using a
set() statement. The content of
storeName is tested to see whether it matches
(or does not match) a string or the content of another store, and the following rule used or ignored accordingly.
A variable store (used in an
reset() statement) should not also be used to match context or key, or output in a rule.
(Note: this advice has changed from previous versions of Keyman. The compiler will warn on this misuse.)
if(opt1 = '1') + any(letterGroup1) > index(outputGroup1,2)
The rule to output a character from the
outputGroup1 store according to a keystroke matching a character in store
only be applied if the content of store
opt1 is exactly equal to the string '1'.
Where two or more separate options are held in stores, the different options can be tested together (logical "AND"):
if(opt1 = '1') if(opt2 = '1') + any(letterGroup1) > index(outputGroup1,3)
or separately (logical "OR"):
if(opt1 = '1') + any(letterGroup1) > index(outputGroup1,2) if(opt2 = '1') + any(letterGroup1) > index(outputGroup1,2)
if() statement can be used in keyboards on the following platforms.
Support for Mac and Linux is incomplete as the options.htm form to set variable stores is not supported.
|Windows||macOS||Linux||Desktop web||Mobile web||iOS||Android|
if() statement was introduced in Keyman 8.0.
Keyman 9.0: Added support for variable system stores.
Keyman for macOS 11.0.221 added support for
reset() for variable stores.