Top  | Previous | Next

Logic / binEnc

binEnc(boolean1, boolean2, ...)

This function, whose name stands for "binary encoder", takes a list of booleans, and treats them like the bits in a binary number. It returns an integer representing the decimal value of the number. The digits go from least significant to most significant.

 

This can be a very handy tool to convert bits into an integer code to drive the Component Styles feature.

 

binEnc(0,0,1,0)

...returns 4 (the value of 0100)

 

binEnc(true,0,1,1,0)

...returns 13 (the value of 01101)