Search code examples
hexdecimalmit-scratch

How can I quickly convert from hexadecimal to decimal in Scratch?


In other languages you can use things like 0xFF = 255. I am working on a decoding project and I would like to be able to quickly convert from hexadecimal to decimal.

I was wondering if there was a very quick way to do this, besides writing a hexadecimal convertor?


Solution

  • It turns out you can! It's fairly simple. Essentially all you have to do is this:

    ((join "0x" "<number>") + 0)
    See it in Scratchblocks!

    You will, however, have to manually create a program to convert from decimal to hexadecimal.