View Single Post
Old 20 August 2015, 00:32   #258
Registered User

Dunny's Avatar
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 661
Originally Posted by Mrs Beanbag View Post
But now the standard BASIC syntax for FOR loops is redundant, you can get rid of it!
Good god, no! It's a standard

"Dim" is a horrid keyword, though... but with type inference you could simply assign arrays defined with some nice syntax to a variable.
It's short for "DIMension" which is what you do - you set an array's dimensions. Later BASICs hijacked this and used it to declare... well, all your variables. Which is wrong. If you absolutely must declare your variables before you use them, then I'd use a DECLARE keyword personally...

Let's go deeper... obviously we can conceive of more complex conditionals, for example:
If A>5 And (A<10 Or A=20) Then ...
so how do you parse that... it is natural and convenient to treat the expression as an arithmetic expression consisting of binary operators, whose result can be 0 or -1.
Which is right and proper. In cases like this, it behooves one to follow one's instincts, and that is to treat all the operators as just that - operators (or in this case, inequalities). That expression is actually just perfect, senseful English.

Then one can end up with such strange but valid statements (and in AMOS this is valid) as this:
there the '=' sign means two different things in the one statement!
And that's a serious fault in AMOS. The whole reason for the LET keyword was to make this sort of thing clearer. Yes, LET is not necessary - I never use it outside Sinclair BASIC - but to the beginner it's necessary to set up the construction of a variable assignment. LET <var>=<value> makes sense when you say it out loud - or if you don't want to appear insane in front of your peers, think it to yourself.

"LET a equal 5"

Straight out of elementary school maths lessons.

"LET a equal the result of b equals 5"

Where a numeric value is assigned for truthiness that statement, with LET, makes perfect sense. AMOS, not having LET, means it looks ambiguous (and therefore confusing to the beginner) even though to the interpreter it's totally fine and rigidly defined as to its meaning.

So BASIC, done well, is not a bad thing when it is used in its proper place, i.e for the beginner to get a leg up on what it means to write a list of instructions for a computer to follow.

Dunny is offline  
Page generated in 0.05672 seconds with 9 queries