Method no return

Sometimes I need to set a specific bit to 1 in a byte.
I made a method BitSet1 which does the job:

parameters byte as byte, bit_to_set1 as byte
reutrn type byte

dim result as byte
result = BitOr (byte, 2 ^ bit_to_set1)
Return result

My problem is have to use like

q = BitSet1 (q, 7)

What I would like is something I can use like this:

BitSet1 (q, 7)

you can do it like that:
Call BitSet1(q, 7)

1 Like

And you’ll need:

parameters byref byte as byte, bit_to_set1 as byte

1 Like

Tried both but not working. There is no error message but the result is incorrect (0)

working now:

byte = BitOr (byte, 2 ^ bit_to_set1)
Return byte

Thanks guys