This function is used by Ignition's Expression language.

Description

This function returns the bit value (an integer, 0 or 1) in a number at a given position, according to its binary representation. The least significant bit in a number is position 0.

Syntax

getBit(number, position)

  • Parameters

Integer number - The number value to start with.

Integer position - The bit position to check.

  • Results

Integer - Returns a 0 or 1, depending on the bit at the position of the integer specified.

Examples
Code Snippet
 getBit(0,0) //Would return 0.
Code Snippet
 getBit(1,0) //Would return 1.
Code Snippet
 getBit(8,2)  //Would return 0.