04-19-2010, 07:54 PM
boriel Wrote:Notice also that FOR upper limit is evaluated ON EACH iteration (like C). So if len(a$) changes, the loop will shorten. So better use a temporary var l to store initial LEN(a$).
I learned it while debugging. It's an important difference with Sincllar Basic.
boriel Wrote:Arrays subscripts starts from 0 to N-1 (like in C). But this behavior can be changed using --sinclair or --array-base switch.
I forgot it! Thanks. One of my tests used "-2" intead of "-1" because of that. Anyway, the problem arises when trying to remove the last char of the string. Then "-2" cannot be used. I tried the following expression:
Code:
let text=text( to len(text)-2+(len(text)=1))
It doesn't work because
Code:
(len(text)=1)
doesn't return "1" when true, as I expected (Sinclair Basic does).
I opened a new thread about this different issue.
Marcos Cruz
http://programandala.net
http://programandala.net