mdalowcode

How to declare a hexadecimal or binary constant in ObjectReef?


I know that in ObjectReef you can declare global variables with the const keyword, for example:

const MyConstant = 1000

But is it possible, instead of a decimal value, to specify a hexadecimal or binary one?

I tried to do as in other languages, such as js.

const MyConstantBin = 0b11010
const MyConstantHex = 0xbaadf00d

but compilation errors occur


Solution

  • hexadecimal numeric constants are used in the form as in Basic or VBA using &h instead of 0x. Based on your example, you can write:

    const MyConstantHex = &hbaadf00d
    

    but unfortunately constants expressed in binary form are not supported in ObjectReef.