Keyboard Support

Contact and Search Homepage

Header bottom

Other versions
Version 18.0 (home page)Version 17.0 (home page, current version)Version 16.0 (home page)Version 15.0 (home page)Version 14.0 (home page)Version 13.0 (home page)Version 12.0 (home page)Version 11.0 (home page)Version 10.0 (home page)Version 9.0 (home page)Version 8.0Version 7.0 (home page)Version 6.0 (home page)Version 5.0 (home page)Version 4.0 (home page)


On this page

if statement

if(%optName% = | != %storeName% | %stringValue%) %ruleContext% + %ruleKey% > %ruleOutput%

The if statement allows any rule to be applied conditionally, depending on the content of store optName, which can be defined either during keyboard configuration or dynamically by using a set statement. The content of store optName 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 store being used for an option (in an if, set, save or reset statement) may also be used to match context or output in a rule, but may not be used to match keystrokes.

if(opt1 = '1') + any(letterGroup1) > index(outputGroup1,1) 

The rule to output a character from the outputGroup1 store according to a keystroke matching a character in store letterGroup1 will 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,1)

or separately (logical "OR")

if(opt1 = '1') + any(letterGroup1) > index(outputGroup1,1) 
if(opt2 = '1') + any(letterGroup1) > index(outputGroup1,1)

The if keyword was introduced in Keyman 8.0.

Related Topics