Ultimate Amiga
Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Professional Forum => Topic started by: Lonewolf10 on January 01, 2017, 08:49:35 PM
-
Hi folks,
I was trying to debug something in AMOS Pro today, and whilst in the direct editor instead of typing...
? $12c
I typed this...
? £12c
... which didn't give me an error. Instead it printed out a number. I have since tried printing various numbers with the pound symbol and can't seem to fathom out what it does.
Searching the internet (with Google) hasn't helped me find the answer. Does anyone here know what the pound sign (£) does?
-
wow you have found :o a special one.
it's magic!
- I did some tests then worked it out.
it becomes a variable and returns a value.
£123
_123
are both valid variable names!
lol!
-
Yep!
It appears you can also use £ as first char of a procedure definition name too
eg Procedure $MYPROC
VERY useful for distinguishing variables from Proc names :)
Not sure if it compiles yet though (not tried so far)
\/1
-
Ahh, thanks for that Mia and Volvo_One
I was aware of the underscore (I use it all the time in variable names) as I'm pretty sure that is mentioned in the AMOS Pro manual.
The pound symbol is a new one to me, despite coding in AMOS (on and off) for over 15 years now! :D
-
AMOS uses the following rules for names:
Can't start with a digit.
'0' thru '9', 'A' thru 'Z' and 'a' thru 'z', '_' are all legal after that but note all upper case letters are stored as lower case (AMOS displays as upper case - but that can be changed in the editor's config file).
Then comes the interesting bit - any ASCII character from Chr$($81) thru Chr$($FF) is also legal. Presumably to allow international characters to be used.
As this range also includes a few other symbols, the results can be quite hilarious. Try checking out the characters you can type with the [Alt] key held down and you'll see what I mean.
Personal favourite is to be able to type "1/4=1" where the "1/4" is the symbol character. One can make almost unreadable code this way but I wouldn't recommend it!
Sent from my Lumia 640 using Tapatalk