Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: The pound symbol  (Read 456 times)

Lonewolf10

  • AMOS Extensions Developer --------------------
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 595
    • http://www.aliensrcooluk.com
The pound symbol
« 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...

Code: [Select]
? $12c
I typed this...

Code: [Select]
? £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?
Logged

Mia

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 74
  • Generic Amiga User
Re: The pound symbol
« Reply #1 on: January 05, 2017, 06:40:27 PM »

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!

« Last Edit: January 05, 2017, 06:53:44 PM by Mia »
Logged

Volvo_0ne

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 21
  • A1200 lover
Re: The pound symbol
« Reply #2 on: January 14, 2017, 06:31:01 PM »

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
Logged
Transuranic heavy elements may not be used where there is life.

Lonewolf10

  • AMOS Extensions Developer --------------------
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Posts: 595
    • http://www.aliensrcooluk.com
Re: The pound symbol
« Reply #3 on: January 20, 2017, 10:28:22 PM »


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
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 410
  • WINUAE Amiga User
Re: The pound symbol
« Reply #4 on: January 23, 2017, 08:44:20 PM »

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
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."
Pages: [1]   Go Up