Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : new$ ???
Author | Message | ||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9081 |
Full-size Colour Maximite, firmware version V4.4 When I try to use new$, I am getting an error. new$="XXX" ...results in... Error: Unexpected text I have looked in the latest manual, in case new$ is a reserved variable or something, but I was not able to find anything. What am I doing wrong? The variable name comes from my want to have a old$ and a new$ for the purposes of using the NAME command for file renaming. This error does not occur with the likes of o$ and n$, so it is an easy workaround, but I am just curious..... Smoke makes things work. When the smoke gets out, it stops! |
||||
greybeard Senior Member Joined: 04/01/2010 Location: AustraliaPosts: 158 |
Maybe check for 'new' without the trailing dollar Just don't type it onto the command line by itself unless you've made sure to backup your code. ps try checking under commands on page 35 of the latest manual |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9081 |
Page 35 of latest manual mentions NEW but nothing about new$... I did see that one, as I have been reading the manual looking for reasons for this. Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
It would be very courageous to use a variable which is too close to a command. The interpreter is finding the NEW but fortunately getting upset about the extra characters. The $ can be seen as an end of word character. I wouldn't try goto$ etc either. (MMEdit highlights NEW$ as a keyword but that doesn't mean that the maximite will act the same way.) Jim VK7JH MMedit MMBasic Help |
||||
ajkw Senior Member Joined: 29/06/2011 Location: AustraliaPosts: 290 |
I think it is safe to say that no command can or should be used as a variable name and doing so rightly generates an error. I have also found on occasion when updating the firmware I get caught with variable ,subroutine or interupt names I have used becoming illegal with the new added commands in the firmware. Cheers. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9081 |
All fair comments - as I say - change that to o$ and n$ and the problem is gone - I was just curious. New rule for me: "Thou shalt not use any commands or keywords as variable names" Sounds like good advise. Smoke makes things work. When the smoke gets out, it stops! |
||||
ajkw Senior Member Joined: 29/06/2011 Location: AustraliaPosts: 290 |
Hi Grogster, My previous post was probably a little forthright, perhaps I should have also offered another idea. n$, although quite adequate, doesn't really describe the variable and there are times when new in a variable name is what you want, therefore is newtext$, newname$, newsomething$, newvalue etc a better alternative?? Cheers, Anthony. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9081 |
Yeah, fair enough comment. I just like SHORT variable names. But I could always use the likes of OD$ and NW$, for example.... Smoke makes things work. When the smoke gets out, it stops! |
||||
Print this page |