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

65 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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

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

Documentation: Red/System Datatypes