Declaring a binary literal

How does one write const x = 00010000; or static x = 00010000; in Squirrel. Other languages you can place 0b or B in front of the binary number.


  • Squirrel doesn't support binary literals. You'd have to use hex, eg const x = 0x10.

    If you're wanting to embed binary blobs in your code, you do this as const strings, eg:

    const image = "\x01\x00\xff\xe5";

    ...these then live in the read only program space of the imp.
  • I'll make a note of that in the Squirrel Programming Guide.
Sign In or Register to comment.