help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interesting results from char


From: Doug Stewart
Subject: Re: interesting results from char
Date: Wed, 21 Jun 2017 11:22:04 -0400



On Wed, Jun 21, 2017 at 11:14 AM, Carlo De Falco <address@hidden> wrote:

> On 21 Jun 2017, at 15:17, Doug Stewart <address@hidden> wrote:
>
> this first part I understand.
>
> >> char [0xbb,0x36]
> parse error:
>
>   syntax error
>
> >>> char [0xbb,0x36]
>          ^
>
> now for the correct way
>
> >> char ([0xbb,0x36])
> ans = �6
> >>
>
>
> now for the interesting results!
>
> >> q= char x=[ 0xbb,0x36]
> parse error:
>
>   syntax error
>
> >>> q= char x=[ 0xbb,0x36]
>             ^
> Ok this is definitely a syntax error
>
>
> now the unusual result.
>
>  char x=[ 0xbb,0x36]
> ans = x=[ 0xbb,0x36]
> >> q=ans
> q = x=[ 0xbb,0x36]
>
> So why when I try
> q= char x=[ 0xbb,0x36]
> it is a syntax error  but
>  char x=[ 0xbb,0x36]
> is not a syntax error and the ans can be used as a string of "x=[ 0xbb,0x36]"
>
>
> Just curious!


I think this is related to the "command form" of Octave functions.
The interpreter parses

 myfunction abcdef

as if you had typed

 myfunction ("abcdef")

therefore

 char x=[ 0xbb,0x36]

is treated as

 char ("x=[ 0xbb,0x36]")

c.



OK but why cant I do

q = char x = [ 0xbb,0x36]


--
DASCertificate for 206392


reply via email to

[Prev in Thread] Current Thread [Next in Thread]