castingred-system

How to cast between integer and character in Red/System?


If I try writing this:

foo: "whatever"
bar: 0
if foo/1 <> as char! bar [
    ;-- stuff
]

Then I am told:

Compilation Error: invalid target type casting: char!

But if I omit the as char and write:

foo: "whatever"
bar: 0
if foo/1 <> as char! bar [
    ;-- stuff
]

Then it tells me:

Compilation Error: left and right argument must be of same type for: <>

How do I cast an INTEGER! to a CHAR! in Red/System?


Solution

  • Currently there is no CHAR! datatype in Red/System.

    The BYTE! datatype maybe what you would like to use.

    Documentation: Red/System Datatypes