Suggest:
FUNCTION Spinner
STATIC LOCAL i = 0
STATIC LOCAL ARRAY aRay = {"|", "/", "-", "\"}
RETURN aRay[i++ % 4]
ENDFUNC
> Some of the extra syntax requirements are not necessary and could be implied. Since "STATIC LOCAL i = 0" contains no decimal points, assume integer.
> If it is "STATIC LOCAL i = 0.00" assume a floating point or double with an assumed 2 decimal points, etc.
Yes that is possible in X#, but slows down the execution speed if not strictly declared. Your solution I can then also say i = "Blah" and only receive a runtime error. In my solution I will get a compile time error with X#. Earlier detection of bad programming.
> LOCAL ARRAY is already an existing syntax in VFP, and use of the { .. } for initializers is very common in languages.
True, however in X# LOCAL a = {"A", "B", "C"} is all that is needed for a lazy array initialization.
> Handling "i++ % 4" will work the same with 0 as it will be 500 million. No need to keep it in the range of 0..3.
I keep it in the range, since I am a purist.
> I note also you're making your arrays reference from 0 instead of 1. While more compatible with other languages,
> it is not compatible with existing VFP / XBASE code. You might want to have some kind of SET ARRAYBASE TO 0 | 1
> setting somewhere, which allows the base to be 1 instead of 0, in which case you should use:
Yes and as I indicated in my comment on the line, the compiler already have a switch /az to force 0 based. The default is 1 based. I just prefer 0 since I interface a lot to c# code and hence makes it easier.