Visual Basic - Bitwise or: or

Bitwise AND or with another name setting to 1. it get the setting to 1 name after logical or operator: just in case it's the result false if both inputs are false, in all other cases the result is true. it transferred to the variables means that only those bits remain 0 where both inputs was 0 otherwise it set to 1. this property can be used for example to setting up specific bits: taking one example, we have one variable in which the 5th, 6th bits we want to set up 1. We need a number where 5th, 6th bit are set to 1 and all other bits are 0: 00110000 in hexadecimal form 30 and decimal 48. we perform a bitwise OR operation, above the number 48 and over the variable, the result will be set the 5th, 6th bits to 1 and other bits remain without changes (xx11xxxx)

or

Description

par1 or par2
Used keywords: or

Input


Output

Examples

Visual Basic .NET

Bitwise or the possible of use:
x = 1 or 2          ' x = 3
y = &Ha or 5        ' y = F
z = &Hf0 or (x or y) ' z = FF

Visual Basic .NET

Even one example in what situations we can use the operation bitwise or:
i or j
&Hff or k
64 or (i or k)

Visual Basic .NET

Other pieces of example codes:
&H01 or &H02

You can find it in the following collections: bitwise operators
Languages: en hu cz sk