View Single Post
Old 19 August 2015, 20:04   #250
Registered User

Megol's Avatar
Join Date: May 2014
Location: inside the emulator
Posts: 209
Originally Posted by Daedalus View Post
I know what you're saying here, but in my mind, the equals means the same thing in all of those cases - it means "Equals". It's the "If" that changes things in the second case there. For someone learning to program, checking the result of an assignment as If (a = 5) does in C seems crazy. Why would you ever need to check if such a simple instruction was carried out? (Yes, I know there are cases where this is useful but that's much more advanced than these examples). And the For loop is actually assigning the value to the variable, so it's the same as the first statement just as part of a larger statement. Besides, that's the same in C, even the same keyword, only with added semicolons to confuse things (are they not end of statement markers?)
C was designed to be concise and powerful. It is, the problem is that the majority of programmers using it shouldn't be.

That one can use assigns in a if statement is because C - unlike many languages - actually is designed and that case falls out naturally.
And it is very useful:
if(a=input_stream_stuff()) {
Or even:
for(;a=input_stream_stuff();) {
String handling in more modern BASICs is much more flexible and standard than maybe you think. For your example, in Blitz the Print statement uses commas to separate arguments, just like every other statement with multiple arguments:
Print "Hello ", name$, " and welcome!"
Blit shape1, x, y
That is just another example on how BASIC isn't a single language. While it may work well in your example (assuming the Blitz print statement can take a list of arguments and print each of them in order) how does it fit into the normal BASIC design?
In standard BASIC commas and semicolons are used as a statement-specific formatting indicator, so if commas are used as argument separators how are semicolons handled? Via a hack...

Alternatively you can join strings and use them as one argument, again, just like with any other command:
Print "Hello "+name$+" and welcome!"
a$ = "Hello "+name$+" and welcome!"
Yes. If the BASIC one uses support it. And if one doesn't need the code to be portable to other BASICs which probably uses a different mechanism.

STR(A$, LEN(A$), LEN(N$))=N$
STR(A$, LEN(A$), 13)=" and welcome!"
The "Let" keyword is all but extinct these days too Anyway, I think these are all just minor things. I do believe BASIC is more instantly accessible - as a kid I always found C very intimidating - and that could be the difference between getting someone interested in programming and giving up at the first hurdle because they didn't understand what stdio.h is, and why it looks different to the other lines.
Nowadays the equivalent of "let" is in many modern languages but for a different reason: indicate to the compiler/interpreter that type inference should be used. Not one of the problems in BASIC IMHO.
Megol is offline  
Page generated in 0.05990 seconds with 9 queries