{{fbdoc item="title" value="BIT"}}----
Gets the state of an individual bit in an integer value.

{{fbdoc item="syntax"}}##
	[[KeyPgPpdefine #define]] **Bit**( //value//, //bit_number// ) (((//value//) [[KeyPgOpAnd and]] ([[KeyPgCast Cast]]([[KeyPgTypeof TypeOf]](//value//), 1) [[KeyPgOpShiftLeft shl]] (//bit_number//))) <> 0)
##
{{fbdoc item="usage"}}##
	//result// = **Bit**( //value//, //bit_number// )
##
{{fbdoc item="param"}}
	##//value//##
		The integer value.
	##//bit_number//##
		The index of the bit.

{{fbdoc item="ret"}}
	Returns an ##[[KeyPgInteger Integer]]## value of ##-1## if the bit is set, or ##0## if the bit is cleared.

{{fbdoc item="desc"}}
	This macro expands to an integer value indicating whether or not the bit specified by ##//bit_number//## is set in the integer ##//value//##. Behaves as `##(//value// [[KeyPgOpAnd And]] 1 [[KeyPgOpShiftLeft Shl]] //bit_number//) <> 0##`.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/bits/bit.bas"}}%%(freebasic)
PRINT BIT(4,2)
PRINT BIT(5,1)
PRINT BIT(&H8000000000000000ULL,63)
%%
	will produce the output:

%%
-1
0
-1
%%

{{fbdoc item="lang"}}
	- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Bit""**##.

{{fbdoc item="diff"}}
	- New to ""FreeBASIC""

{{fbdoc item="see"}}
	- ##[[KeyPgBitset Bitset]]##
	- ##[[KeyPgBitreset Bitreset]]##

{{fbdoc item="back" value="CatPgBits|Bit Manipulation"}}