|
From: | Doug Stewart |
Subject: | Re: interesting results from char |
Date: | Wed, 21 Jun 2017 11:22:04 -0400 |
I think this is related to the "command form" of Octave functions.
> 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!
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.
[Prev in Thread] | Current Thread | [Next in Thread] |