Skip to main content

Rules: Expressions and operators

scripts/gen-rules.mjs builds this page from rules/*.json. Do not edit it by hand; edit the JSON and run npm run gen-rules. The rule bullets on topic pages (- **[ID]**) are filled from the same source.

Explanations and examples are on the topic page Expressions and operators.

IDRuleLevelEvidence environmentSource
EXP-01The operators you can use are =, <, >, not, and, or, +, -, *, / and the string truncation '%.Ns' *. The precedence is as in the table below (CN reconstruction).measured, working pack, vanilla, code (source)unknownBC-S14, BC-facts, BC 6.2-1, AP 4.7, VN, BW-intro, CN
EXP-02% is not an operator. ((#c % 10) = 3) raises an Invalid expression assert every time the screen opens. Do not use expressions like (x - x % 65536) / 65536 from community examples (Chest-UI, etc.). On Windows 1.26.65.1 ((#v - 0) % 5) also gave no value (measurement record). Make remainders with EXP-38.measuredWindows 1.26.65.1BC-S14, BC-facts, MJ 4.2-7
EXP-03There are no >= and <=. A failed expression leaves the property at its default, so written to #visible it looks always true. Write (a > b) or (a = b) (the generator ASJ uses this form too). In the CN evaluator <= is read as two operators and the whole expression becomes null. (not (#v < a)) is also an alternative. On Windows 1.26.65.1 ((#v - 0) >= 10) gave no value and (not ((#v - 0) < 10)) was true at 10 (measurement record).measured, code (source)Windows 1.26.65.1BC-facts, BW-intro, CN-run, ASJ
EXP-04< and > work (CN evaluator, AP's use of >). The chained comparison 962 < #c < 964 is not a range check (EXP-28). On Windows 1.26.65.1 < worked, and at 10 (((#v - 0) > 5) and ((#v - 0) < 17)) was true while the chained (5 < (#v - 0) < 7) was a wrong true. ((5 < (#v - 0)) and ((#v - 0) < 7)), with literals on the left, gave no value (cause not isolated, measurement record). So write a range with the property on the left, as in ((#c > 962) and (#c < 964)).measured, working pack, code (source)Windows 1.26.65.1BC-S14, BC-facts, BC-S9, AP 4.7, CN-run
EXP-05Even '%.6s' * #text = 'x' without parentheses worked because the product (truncation) is computed before the comparison. Still, write the parentheses explicitly.working pack-AP 4.4
EXP-06An expression that is too deep (((#c + #t + (#c * #t)) = 964963)) fails. Split it into step-by-step view bindings and put the intermediates in properties. But the CN evaluator computes up to 512 levels of nesting, so the cause of the failure may be types, not depth. If #c and #t are chest quantities they are strings (EXP-17), and string + is concatenation.measured, inferredunknownBC-S14, CN-run
EXP-07Containment check: (not ((#s - 'X') = #s)). If X is contained, the erased result differs from the original. It is independent of position so there is no need to compute field boundaries.working pack-BA chapters 2 and 3.3, AP 4.1, BW-form, BW-title
EXP-08Prefix check: (('%.Ns' * #s) = 'X'), N is the byte length of X. Short flags (t/f) must be cut and compared at length+1 so that a long value starting with f is not mistaken: (('%.2s' * #v) = 'f').code (source), working pack-BC 4.1-(4), BC 6.2-2, AP 4.4
EXP-09'%.Ns' cuts in UTF-8 bytes. Hangul is 3 bytes and letters and digits are 1 byte. Padding and truncation of fixed-width fields are computed by bytes. Padding formats such as %7.4s, %-7.4s and %4.2s returned the input unchanged on Windows 1.26.65.1, with no truncation and no padding (measurement record). § is 2 bytes and most emoji are 4 bytes (EXP-24). For padding formats, see EXP-25.measured, code (source), working packWindows 1.26.65.1BA 3.1 utf8Length encoder, MJ 4.2-9, BW-intro, CN-run
EXP-10'%.Ns' * X cuts bindings (#…), expressions containing bindings (('%.7s' * (#text - ('%.6s' * #text)))) and string literals alike. On Windows 1.26.65.1 (('%.3s' * 'abcdef') + (#v - #v)) was abc. Removing the # property from the same expression makes the binding fail with Must define a source property name in the binding! (BND-05, measurement record). A creation-time constant expression "$cut": "('%.3s' * 'abcdef')" is also cut to abc. The CN evaluator also cuts literals.measured, working packWindows 1.26.65.1BC-facts, AP 4.5, CN
EXP-11Taking L bytes after N bytes is done in three steps.working pack-BA 3.2, AP 4.5
EXP-12String - erases every occurrence. So padding characters ($, etc.) and reserved characters must not appear in the body, and the encoder must remove them in advance. For the same reason (#s - #head) also erases the same string as #head if it appears later again. Make the head part long and unique enough. On Windows 1.26.65.1 'xaxbx' - 'x' was ab and 'abab' - 'ab' was an empty string (measurement record).measured, working packWindows 1.26.65.1BA 3.2, AP 4.5
EXP-13The trick of erasing only the first N bytes, (('@' + s) - ('@' + ('%.3s' * s))) - '@'. On Windows 1.26.65.1, (('§_' + ('@' + #v)) - ('@' + ('%.3s' * #v))) on abcabc was abc (only the first three characters went). The plain cut (#v - ('%.3s' * #v)) erased both abc and gave empty (measurement record). The final - '@' also erases any @ in the body, so choose a character not in the body.measuredWindows 1.26.65.1MJ chapter 8-6, 2026-11-19 Windows 1.26.65.1
EXP-14Attach a terminator to containment check tokens (name.1b;) and design them so no prefix or suffix relationship arises among tokens. X.1b; also matches aX.1b;. If built like an uppercase group + lowercase bit (~Fo, ~Xa), there is no prefix relationship among them.working pack-AP 4.1, BA 3.3
EXP-15The engine decides the type of an expression result by its appearance. A string that looks like a number ('0', '3/17', '12') becomes a number and string comparison goes wrong. Put a letter prefix on values that must not be interpreted as numbers: flags t/f, tab number Ta, progress §f3/17, percent P050. A string with letters mixed in ('a123') does not become a number even with arithmetic. Cause: the result string of an operation is reinterpreted (EXP-30).code (source), working pack-BC 4.1-(4), BA 3.1, BW-type, CN-run
EXP-16The sure way to turn a string into a number is (#v - 0). (#v + 0) becomes concatenation ('350'). Do not use (#v * 1): string * number is an empty string (EXP-31). On Windows 1.26.65.1 ('4' * 1) was an empty string, (('4' * 1) = 4) false and (('4' - 0) = 4) true. A pack where * 1 works applies it to an operand that is already a number ('042' cut with '%.3s' is immediately the integer 42, EXP-30). (0 + #v) works too: with a chest slot count of 4, ((0 + #inventory_stack_count) = 4) was true in game (EXP-17).measured, working pack, code (source), inferredWindows 1.26.65.1BC-S12, BC-S9, BC-facts, BA-original, AP 4.5, BW-type, CN-run, CPR
EXP-17The #inventory_stack_count of a chest slot is a string inside expressions. In a slot holding 4, (#count = 4) was false while (#count = '4'), ((0 + #count) = 4) and ((#count - 0) = 4) were true. To compare with a number, convert first with 0 + or - 0 (EXP-16). With a count of 1 the value is empty, so (0 + #count) is 0 (TXT-12). Even binding it directly to text as vanilla does does not display (so the lang key workaround of TXT-12 is needed).measuredunknownBC-facts, CN-run, CPR
EXP-18Arithmetic is integer-centered. A decimal literal with a leading digit is an integer (EXP-27): 0.3 is 0 and 0.001 is 0, so ((#v = #v) * 0.3) was 0 and (#t * 0.001) = 1 was false. A real literal starts with a dot like .3. Division of integers (#v / 100) and (#v / 100.0) is also an integer, so to make a 0~1 value such as #clip_ratio from an integer, use (#v * .01). Integer arithmetic is 32-bit (int32) and wraps on overflow: on Windows 1.26.65.1 2147483647 + 1 was -2147483648 and 65536 * 65536 was 0 (measurement record). For integer literals and strings outside 32 bits, see EXP-50.measured, code (source), code (binary)Windows 1.26.65.1, Android 1.26.52.3BC-S12, BC-S14, BA-original, CN, CN-run, NB, 2026-11-19 Windows 1.26.65.1
EXP-19A boolean is true 1 and false 0 in arithmetic. Make a factory length 0/1 with ((#mode = 'on') * 1).measuredunknownBC-facts, BC-S11, BW-type
EXP-20There are no floor and remainder operators (% gives no value, EXP-02). Build a remainder from integer division: on Windows 1.26.65.1 ((#v - 0) - (((#v - 0) / 5) * 5)) gave 2 for 17, and on numeric channel integers (#v - ((#v / 5) * 5)) gave 3 for 13 and -2 for -7 (EXP-38, measurement record). So fields packed into one number can be split out with expressions (bit extraction, EXP-39, was not measured). Sending several values as string fields or several channels also works.measuredWindows 1.26.65.1BC-S14, 2026-11-24 Windows 1.26.65.1
EXP-21Dividing a string freezes the client: in a step-by-step measurement on Windows 1.26.65, (bool / 100) was fine and (#text / 100) froze (EXP-49). There is also a record of a chest screen using (#count / 19) and ('' + #count) together that exited the client as soon as it opened; whether that exit has the same cause was not checked. Vanilla uses empty string comparison like (not (#texture = '')), so comparison is safe. Do not divide strings, and when concatenating use a non-empty prefix like ('n=' + #x).measured, vanillaWindows 1.26.65BC-facts, BC-S14, VN server_form.json:159
EXP-22String + integer is concatenated but in string + float the float part is empty and only the string is left. To show a float as text, split ranges with a comparison chain or send it through an integer channel. If you know the range of values, you can get the integer part by adding comparison results like (0 + (#f > 0) + (#f > 1) + … + (#f > 9)). Cause: the "text" of a real value is empty (CN). The literal 1.5 is the integer 1, so ('n=' + 1.5) is 'n=1' (EXP-27). Chest slot durability is a float too, so ('D ' + (0 + #item_durability_current_amount)) gave only 'D ' while a > 100 comparison on the same value worked (COL-07).measured, code (source)unknownBC-facts, BW-type, CN-run, CPR
EXP-23The #item_custom_color of a dyeable custom item is a signed ARGB integer (0x123456 is -15584170). Comparing by RGB value does not match.measuredunknownBC-S14
EXP-24UTF-8 byte counts: U+0000~U+007F 1 byte (letters and digits), **U+0080~U+07FF 2 bytes (including §)**, U+0800~U+FFFF 3 bytes (Hangul, private-use-area glyphs), U+10000 and above 4 bytes (most emoji). When doing a prefix check (EXP-08) on a title with color codes, count N taking into account that one §a is 3 bytes. If you cut in the middle of a multibyte character, that character is not drawn. On Windows 1.26.65.1 § was cut as 2 bytes, Hangul as 3 and emoji as 4, and a cut in the middle of a character also dropped the character concatenated right after it (measurement record).measured, code (source)Windows 1.26.65.1BW-intro, the UTF-8 spec
EXP-25The only working format specifier is '%.Ns' (first N bytes). The printf-style padding formats ('%N.Ms', '%-N.Ms', '%Ns', '%-Ns', '%0Ns') neither cut nor pad and return the input unchanged: on Windows 1.26.65.1 %7.4s, %-7.4s, %9s, %-9s, %09s and %4.2s all did (measurement record). The CN evaluator also recognizes only the %.Ns form. Padding of fixed-width fields is done by the encoder (script) and the UI only cuts.measured, code (source)Windows 1.26.65.1BW-intro "Format Specifiers", CN-run
EXP-26A result left with only numbers after string subtraction could be used as a number as is: putting (#count - 'Count:' + 0) into #collection_length with the title Count:3 created 3, and putting it into #maximum_grid_items with Count:15 created 15. This differs from S12 saying that doing + 0 on the original bound string concatenates ('35' + 0 gives '350'), so treat it as a case where the type of an intermediate result of an expression is decided again by appearance (EXP-15). To be sure, write ((#count - 'Count:') - 0).measured, inferredunknownBW-dyn, 2 screenshots, BC-S12
EXP-27A decimal literal with a leading digit is an integer. 0.3, 1.0 and 100.0 are 0, 1 and 100. A real literal starts with a dot like .3 and .01. Division of integers is an integer. Make ratios with (#v * .01). On Windows 1.26.65.1, 10 times 0.3 was 0, 10 times 1.5 was 10, and (((#v - 0) * .3) = 3) was true (measurement record). On 100, (((#v - 0) * .01) = 1) was true and ((#v - 0) * 0.01) was 0. The literals 100.0 and 4.5 were integers too (100, 4), but the JSON variable value "$hm": 100.0 stayed real, and ((#v - 0) / $hm) on 50 was 0.5 (measurement record). "$max": 20.0 also stayed real: the visible expressions (((20.0 - 15) / $max) > .2) and (... < .3) were both true, and the same expression with #z added and written to #clip_ratio clipped the bar by 0.25. The literal 20.0 is the integer 20, but the result is the same (2026-11-24).code (source), measuredWindows 1.26.65.1CN, CN-run, BC-S12 * 0.3 gives 0, 2026-11-24 Windows 1.26.65.1
EXP-28Do not write comparisons as a chain. (a < #v < b) is ((a < #v) < b) so it is always true (or always false). Write ((a < #v) and (#v < b)). In a Windows 1.26.65.1 measurement the chained comparison gave a wrong true. However ((5 < x) and (x < 7)), with the literal on the left, gave no value while ((x > 5) and (x < 17)) worked (cause not separated, measurement record).code (source), measuredWindows 1.26.65.1CN-run, 2026-11-18 Windows 1.26.65.1
EXP-29and and or have the same precedence and are computed from the left. a or b and c is (a or b) and c. Use parentheses when mixing. For a parenthesized (not X) used as an operand of and/or (((not (#v = 'a')) or (#v = 'b')), ((not (#v = 'a')) and (not (#v = 'b')))) and for not applied to a parenthesized and group ((not ((#v = 'a') and (#v = 'c')))), two measurements disagree. A measurement inside a server form window on 2026-11-18, Windows 1.26.65.1, gave no value (measurement log). A measurement on the HUD on 2026-12-04, Windows 1.26.65, reading #hud_title_text_string into #visible, gave the right value for both titles a and c. Which condition makes them fail was not determined. The forms that worked in both measurements are (not (#v = 'a') or (#v = 'b')) without parentheses around the not term, (((#v = 'a') = false) or (#v = 'b')), a plain (x or y or z) with three terms, and not (#v = 'a') alone. Use these forms to be safe.code (source), measured, conflictWindows 1.26.65.1, Windows 1.26.65CN test E12, 2026-11-18 Windows 1.26.65.1, 2026-12-04 Windows 1.26.65
EXP-30A result string of an operation is reinterpreted. If it starts like a number, the leading integer ('3/17' gives 3, '10 apples' gives 10. A number outside 32 bits becomes a float (EXP-50)), if yes, no, true or false, a boolean, and if it starts with #, a property name. So '042' cut with ('%.3s' * #s) is immediately the integer 42.code (source)-CN-run
EXP-31string * number is an empty string, and number * string is the left number. (#s * 1) and (1 * #s) are not number conversions. The conversion is (#s - 0) or (0 + #s). (#s + 0) appends a 0 at the end. On Windows 1.26.65.1, * 1 on '4' gave an empty string and - 0 gave 4 (((#v - 0) = 4) true, measurement record). * 1 on text cut with '%.3s' is also an empty string: with #s as abcdef, (('%.3s' * #s) * 1) was empty, ('B' + (('%.3s' * #s) * 1)) was B and ('A' + ('%.3s' * #s)) was Aabc (2026-11-24).measured, code (source)Windows 1.26.65.1CN-run, the same conclusion as EXP-16, 2026-11-24 Windows 1.26.65.1
EXP-32string / string is the occurrence count (('a-b-a' / 'a') = 2). string / number is always 1. Dividing by 0 leaves the left value as it is. This value is the result of the reconstructed evaluator; in game, string / number froze the Windows 1.26.65 client (EXP-49). String / string did not freeze Windows 1.26.65.1: ('a-b-a' / 'a') in a binding expression was 2, and the separator check ((#v / 'separator') > 0) was true. It also worked as a containment check in requires of variables, but the same expression in ignored did not hide the control (measurement record).code (source), measuredWindows 1.26.65, Windows 1.26.65.1CN-run, 2026-11-19 Windows 1.26.65.1
EXP-33On a numeric string, - '0' erases every 0 ('100' becomes 1). To convert to a number, use - 0 without quotes.code (source)-CN-run
EXP-34Comparing a string and a number with = is true only when both are falsy values ('' and 0). ('2' = 2) is false and (true = 'true') is also false. Match the type of one side before comparing.code (source)-CN test E15
EXP-35If the result of a parenthesized group is a '#name' string, it is replaced by the value in that control's bag. So a dictionary lookup result can be compared within the same expression, as in (('#route_' + #id) = 'x').code (source)-CN-run, COL-23 reinforcement
EXP-36Tokens break only at spaces, parentheses, $ and * + - / < = >. Using - in a property name makes it subtraction, so use _. : and . may be used in names.code (source)-CN test E05
EXP-37Unary - on a string is 0 ((-#s) is 0). Unary - and not attach only to the operand right after, so (not #a = #b) is ((not #a) = #b).code (source)-CN-run, CN test E08
EXP-44If the cut-out front part starts with a digit, it is read as a number (EXP-30, the same in game): on the body 042§r§r§r…, (#form_text - ('%.12s' * #form_text)) could not erase the body and broke. Put numeric fields after letters (§r§r§r042).measuredWindows 1.26.52DF
EXP-45If the server writes the cell count in the first 12 bytes of the body as §r§r§r + a three-digit number, the number can be taken out with the single expression ((('%.12s' * #form_text) - '§r') - 0) and put into #maximum_grid_items. Comparing a single digit character ('3') with a character using = did not match (EXP-34), and changing it to letters a~f matched. The body label subtracts these 12 bytes with (#form_text - ('%.12s' * #form_text)).measuredWindows 1.26.52DF
EXP-46An expression containing %, (#t - (#t % 65536)), was left in #item_id_aux for a long time, yet item icons were drawn and no Invalid expression was left in the content log of the release client (the assert of EXP-02 is a development build record). There was an impression report that the form became faster after changing to (#t - 0) but it was not re-measured. In a Windows 1.26.65.1 measurement window, by contrast, six rows including two with % gave no value and each load printed 6 Invalid expression lines; rows and lines were not matched one by one (measurement record).measured, inferredWindows 1.26.65.1, Windows 1.26.52DF, 2026-11-18 Windows 1.26.65.1
EXP-47The item renderer reads #item_id_aux only when it is a JSON integer; text or a fraction draws air (an empty item). So an expression that takes an item number out of text ends with (... - 0) so that the final result is read again as an integer. If an intermediate result starts with a digit, space, +, - or . while the expression runs, only the leading number is frozen into an integer at that point and the rest of the text is dropped (EXP-30, EXP-44). Do not put a number field at the very start of the record; send each field with a letter marker in front, then remove the marker in the last step and apply - 0. A zero-padded number (00042) is read as decimal in the final re-read. Use only 0 to 32767 for the data value (the engine uses the bit above for something else). This was read from the Windows 1.26.63 client and not measured separately in game.code (binary)Windows 1.26.63, Android 1.26.52.3NB
EXP-48When the text of an operation result is read again, a float read is tried after the integer read, so a result starting with inf, infinity or nan ('Info: ...', 'nancy') may become a float and vanish from a label, and a result starting with 0x may become the integer 0. This is inferred from the behavior of the C standard functions. On Windows 1.26.65.1, results starting with 'Info: a', 'nancy', '0x12' and 'inf' were empty in the label (measurement record). Make a result that must not be read as a number start with a letter prefix such as §r (EXP-15).measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB
EXP-49Dividing a string by a number (#text / 100) freezes the Windows 1.26.65 client. A single view binding ('' + (#form_button_text / 100)) in a server form button cell made it stop responding, using almost no CPU and never coming back. In the same cell (#text * 1), (1 - #text), (bool / 100) and (#text - ('%.32s' * #text)) did not freeze. * 1 does not turn a string into a number, so ((#a - #b) * 1) / 100 is the same expression. Convert with (#v - 0) before dividing (EXP-16). The same expression did not freeze on mobile 1.26.63 (wiki example json-ui-performance v1.3.0). It is the likely cause of EXP-21. Even after the conversion it is not certainly safe: on 2026-11-19 Windows 1.26.65.1, ((#v - 0) / 5), ((#v - 0) / 16) and ((x - 0) / 16) on a value taken out by string subtraction gave integers cut toward 0 in one window, but in another window holding other experiments the same expressions froze the client as soon as the window opened, and the cause was not separated. The floor division form that adds or subtracts a comparison product and then divides, ((x - ((x < 0) * 15)) / 16), did not freeze but was empty (measurement record).measuredWindows 1.26.65, mobile 1.26.63, Windows 1.26.65.1step-by-step bisect on 2026-11-18, 2026-11-19, Windows 1.26.65
EXP-50An integer literal outside the 32-bit range becomes a float. A word that cannot be read as an integer is read again as a float, and a float has empty text (EXP-22), so it disappears when concatenated into a string. ('E10=' + 3000000000) was E10=, and the literals 2147483648 and 4294967296 were empty values. The same holds when the result string of an operation is read again (EXP-30): the subtitle string 12 turned into a number with ('' + #s) gave 13 after adding 1, but -8589934591 was an empty value the same way. A JSON integer in property_bag keeps only its low 32 bits (-8589934591 is 1, 2147483648 is -2147483648). Do not handle large numbers such as 64-bit entity IDs as numbers in expressions.measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-19~20 Windows 1.26.65.1
EXP-51and, or and not are operators only in lowercase. Other spellings such as AND become string values, so several values are left in that parenthesized group and the group becomes null (EXP-52). On Windows 1.26.65.1 ('E11=' + (1 AND 1) + 0) was E11=0.measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-20 Windows 1.26.65.1
EXP-52If a parenthesized group does not end with exactly one value, the result of that group is null, and the outer expression keeps computing with that null as a value. (#one #one) (two values) and (1 AND 1) (three values) are such groups. The text of null is empty, so ('E11=' + (1 AND 1) + 0) becomes E11=0. The engine code leaves no log in this case. This differs from a parse failure that empties the whole expression (EXP-53).measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-20 Windows 1.26.65.1
EXP-53Unary + leaves a number as it is and turns a string into 0. On Windows 1.26.65.1 (+'abc') was 0, (+#one) was 1 and (-#one) was -1. A parenthesized group right after unary + makes the whole expression fail: (+(#one = 1)) emptied the whole expression and left Invalid expression in the log. To turn a string into a number, use (#v - 0) instead of unary + (EXP-16).measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-20 Windows 1.26.65.1
EXP-54In > and <, when only one side is a string, truthiness is compared instead of size. (a > b) is true only when a is truthy and b is falsy, and (a < b) only when a is falsy and b is truthy. So ('abc' > 0) is true, and ($v > 0) or (#v > 0) cannot tell whether a value is a number (a non-empty string is true). In =, when one side is a boolean both sides are compared as truthiness, so (5 = true) is true. Numbers are compared as float32, so (16777217 = 16777216) is true too. Before comparing a string binding with a number, convert it with (#v - 0) (EXP-16, EXP-34).measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-20 Windows 1.26.65.1
EXP-55Dividing by 0 leaves the left value with its type. On Windows 1.26.65.1 ((#one = 1) / 0) was the boolean true. When only the right side is a string, the result is 0 (0.0 if the left side is a float): (5 / 'a') was 0 and did not freeze the client. The division that froze was the one with a string on the left (EXP-49).measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-20 Windows 1.26.65.1
EXP-56A string variable starting with # becomes a property name inside an expression. With "$v": "#one", (#one + $v) was 2. The same log also had the warning Expected variable not found: '$v'. The name lookup happens right at the operand position, not when a parenthesized group ends (EXP-35). Other variable strings are not read again as numbers.measured, code (binary)Windows 1.26.65.1, Android 1.26.52.3NB, 2026-11-20 Windows 1.26.65.1
EXP-57A constant expression in a $variable value is computed. A text: "$cut" label receiving "$cut": "('%.3s' * 'abcdef')" showed abc. The property value resolver, after finding the $ value, computes a string starting with ( as a constant expression (FILE-48). To use this variable in a binding expression, the expression needs a # property: ('R' + $cut) was dropped at load, and (#z + $cut) with "#z": "R" gave Rabc (BND-42).measured, code (binary)Windows 1.26.65.12026-11-24 Windows 1.26.65.1, 2026-11-24 decompilation

Proposed rules​

These proposals are not merged into the adopted rules yet. Check the evidence before using them.

IDRuleLevelEvidence environmentSource
EXP-38Make remainders with integer division instead of %: (a - ((a / b) * b)). It is right only when both operands are integers, so first convert string bindings with (#v - 0) (string / number is 1, EXP-32). Put the computation in one auxiliary view binding and reuse it. On Windows 1.26.65.1, ((#v - 0) - (((#v - 0) / 5) * 5)) gave 2 for 17, and the same form dividing -7 by 3 gave -1 (ASJ 4.1, measurement record). On the numeric channel (a JSON integer in property_bag), (#v - ((#v / 5) * 5)) without conversion gave 3 for 13, -2 for -7 and 0 for 20 (2026-11-24). The remainder of a negative number is negative.measured, code (source)Windows 1.26.65.1ASJ 3.1 and 4.1, CN EXP-18, 2026-11-24 Windows 1.26.65.1
EXP-39To take bit i out of an integer, put ((#v / 2^i) - ((#v / 2^(i+1)) * 2)) (compute the power of two as a number in advance) in an auxiliary binding per bit. It lets the bit tokens of PAT-06 be sent as one number instead of a string.code (source), inferred-ASJ 4.1
EXP-40A start check for two runtime strings of unknown length: attach a unique prefix P that does not appear in the body to both to make auxiliary bindings #a = (P + #s) and #b = (P + #p), and decide with (not ((#a - #b) = #a)). When cutting off the front part too, cutting from the string with P attached means the same head is not erased even if it appears later (EXP-12).code (source), inferred-ASJ 3.2 and 4.2
EXP-41To choose one of two numbers by a condition, use ((#c * #a) + ((not #c) * #b)), and make an absolute value with the sign ((-1 + ((#x > 0) * 2)) * #x). It relies on boolean arithmetic (EXP-19) and is not used with string operands (EXP-31).code (source), inferred-ASJ 3.2
EXP-43A format string can be built inside an expression by concatenation: (('%.' + $to + 's') * #t). The byte range [from, to) is taken out with ((('%.' + $to + 's') * #t) - (('%.' + $from + 's') * #t)). If the front piece appears again later it is erased together (EXP-12), so make the head unique. On Windows 1.26.65.1, format strings with N from a binding ('3'), from $n and from literal pieces all gave abc (measurement record).measured, working pack, code (source)Windows 1.26.65.1SLB chapter 5, ASJ 4.3
Sources
idSourceLicenseCommitAccessed
repo-guideJSON UI comprehensive guide (this repository) (guide/)This project's material2026-11-13
private-researchPrivate research (-)-2026-11-13