[Oberon] CHAR to/from BYTE conversion
Srinivas Nayak
sinu.nayak2001 at gmail.com
Wed Jul 6 18:19:13 CEST 2016
Hmmm...
That means both CHAR and BYTE holds values 0 to 255.
But BYTE values can take part in calculations,
where as CHAR values are only interpreted as ASCII codes, which can't take part in calculations.
With thanks and best regards,
Yours sincerely,
Srinivas Nayak
Home: http://www.mathmeth.com/sn/
Blog: http://srinivas-nayak.blogspot.in/
On 07/06/2016 08:23 PM, Jörg wrote:
> Hi Srinivas
>
> Let's assume you have three variables
> VAR
> c: CHAR;
> b: BYTE;
> i: INTEGER;
>
> If you write c := CHR(b), it internally works as if you wrote i := b; c :=
> CHR(i);
> If you write b := ORD(c), it internally works as if you wrote i := ORD(c); b
> := i;
>
> The difference of BYTE and CHAR is the type;
> with BYTE you can do calculations, with CHAR you cannot. CHAR hold ASCII
> characters.
>
> Jörg
>
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of Srinivas
> Nayak
> Sent: Mittwoch, 6. Juli 2016 16:00
> To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
> Subject: [Oberon] CHAR to/from BYTE conversion
>
> We have ORD() and CHR().
> ORD() converts CHAR to INTEGER.
> CHR() converts INTEGER to CHAR.
>
> How to convert BYTE to/from CHAR ?
>
> Can a CHAR byte hold -ve values? Seems not...
> BYTE also represents values from 0 to 255.
> Then what is the difference between BYTE and CHAR?
>
> We say, BYTE and INTEGER are compatible;
> If we assign -12 to a BYTE, what will happen?
>
> Kindly help me understanding these.
>
>
> With thanks and best regards,
>
> Yours sincerely,
> Srinivas Nayak
>
> Home: http://www.mathmeth.com/sn/
> Blog: http://srinivas-nayak.blogspot.in/
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
>
More information about the Oberon
mailing list