main
byte b1
byte b2 = b1.copy // b2 == 0
Class represents a byte. Byte can hold 8 bits, out of which one bit is reserved for sign. Therefore range of values byte can hold is [-128..127].
Creates a copy of source.
main
byte b1
byte b2 = b1.copy // b2 == 0
Negates byte provided as parameter.
main
byte b1 = 1.truncate
byte b2 = -b1 // b2 == -1
Performs addition of two bytes.
main
byte b1 = 1.truncate
byte b2 = 2.truncate
byte b3 = b1 + b2 // b3 == 3
Performs subtraction of two bytes.
main
byte b1 = 1.truncate
byte b2 = 2.truncate
byte b3 = b1 - b2 // b3 == -1
Performs multiplication of two bytes.
main
byte b1 = 4.truncate
byte b2 = 2.truncate
byte b3 = b1 * b2 // b3 == 8
Performs division of two bytes.
main
byte b1 = 4.truncate
byte b2 = 2.truncate
byte b3 = b1 / b2 // b3 == 2
Performs division of two bytes and returns the remainder.
main
byte b1 = 5.truncate
byte b2 = 2.truncate
byte b3 = b1 % b2 // b3 == 1
Performs bitwise AND on two bytes.
main
byte b1 = 107.truncate // b1 as binary: 0110 1011
byte b2 = 38.truncate // b2 as binary: 0010 0110
byte b3 = b1 band b2 // b3 as binary: 0010 0010 (== 34)
Performs bitwise OR on two bytes.
main
byte b1 = 107.truncate // b1 as binary: 0110 1011
byte b2 = 38.truncate // b2 as binary: 0010 0110
byte b3 = b1 bor b2 // b3 as binary: 0110 1111 (== 111)
Performs bitwise XOR (=Exclusive OR) on two bytes.
main
byte b1 = 107.truncate // b1 as binary: 0110 1011
byte b2 = 38.truncate // b2 as binary: 0010 0110
byte b3 = b1 bxor b2 // b3 as binary: 0100 1101 (== 77)
Performs a left shift to byte.
main
byte b1 = 13.truncate // b1 as binary: 0000 1101
byte b2 = b1 << 1.truncate // b2 as binary: 0001 1010 (== 26)
byte b3 = b1 << 2.truncate // b3 as binary: 0011 0100 (== 52)
Performs a right shift to byte.
main
byte b1 = 52.truncate // b1 as binary: 0011 0100
byte b2 = b1 >> 1.truncate // b2 as binary: 0001 1010 (== 26)
byte b3 = b1 >> 2.truncate // b3 as binary: 0000 1101 (== 13)
Perform addition to byte.
main
byte b = 10.truncate
b += 12.truncate // b == 24
Perform subtraction from byte.
main
byte b = 10.truncate
b -= 12.truncate // b == -2
Perform multiplication to byte.
main
byte b = 5.truncate
b *= 6.truncate // b == 30
Perform division to byte.
main
byte b = 18.truncate
b /= 6.truncate // b == 3
Perform division to byte and set remainder as value. ????
main
byte b = 20.truncate
b %= 6.truncate // b == 2
Perform binary AND to byte.
main
byte b1 = 107.truncate // b1 as binary: 0110 1011
byte b2 = 38.truncate // b2 as binary: 0010 0110
b1 &= b2 // b1 as binary: 0010 0010 (== 34)
Perform binary OR to byte.
main
byte b1 = 107.truncate // b1 as binary: 0110 1011
byte b2 = 38.truncate // b2 as binary: 0010 0110
b1 |= b2 // b1 as binary: 0110 1111 (== 111)
Perform binary XOR (=Exclusive OR) to byte.
main
byte b1 = 107.truncate // b1 as binary: 0110 1011
byte b2 = 38.truncate // b2 as binary: 0010 0110
b1 ^= b2 // b1 as binary: 0100 1101 (== 77)
Perform a left shift to byte.
main
byte b = 13.truncate // b as binary: 0000 1101
b <<= 1.truncate // b as binary: 0001 1010 (== 26)
b <<= 2.truncate // b as binary: 0110 1000 (== 104)
Perform a right shift to byte.
main
byte b = 104.truncate // b as binary: 0110 1000
b >>= 1.truncate // b as binary: 0011 0100 (== 52)
b >>= 2.truncate // b as binary: 0000 1101 (== 13)
Increment value by one.
main
byte b = 101.truncate
b++ // b == 102
Decrement value by one.
main
byte b = 101.truncate
b-- // b == 100
Test whether parameters have the same value.
main
byte b1 = 10.truncate
byte b2 = 11.truncate
bool result = b1 == b2 // result == false
Performs a comparison whether first parameter is smaller than second.
main
byte b1 = 10.truncate
byte b2 = 11.truncate
bool result = b1 < b2 // result == true
Performs a comparison whether first parameter is smaller or equal to the second parameter.
main
byte b1 = 10.truncate
b1++
byte b2 = 11.truncate
bool result = b1 <= b2 // result == true
Test whether parameters are not equal.
main
byte b1 = 10.truncate
byte b2 = 11.truncate
bool result = b1 != b2 // result == true
Performs comparison whether first parameter is larger than second.
main
byte b1 = 10.truncate
byte b2 = 11.truncate
bool result = b1 > b2 // result == false
Performs comparison whether first parameter is larger or equals the second paramer.
main
byte b1 = 10.truncate
b1++
byte b2 = 11.truncate
bool result = b1 >= b2 // result == true
Minimum value a byte can contain..
main
byte b = byte.minimum value // b == -128
Maximum value a byte can contain.
main
byte b = byte.maximum value // b == 127
Returns byte as string.
main
byte b = 100.truncate // b == 100
string s = b // s == '100'
Returns byte as int.
main
byte b = 100.truncate // b == 100
int i = b // i == 100
Returns absolute value of byte.
main
byte b1 = (-100).truncate // b1 == -100
byte b2 = b1.abs // b2 == 100