View Full Version : Console_WriteLine don't accept negative numbers?
Why Console_WriteLine don't accept negative values?
9764 9765
4th line is OK but 5th line says: "Error 262 - Invalid delimiter".
my opinion:
the 1 considered by Console_WriteLine as string and not a number, the proof is
Console_WriteLine 1+1 will output 11 and not 2. while in the case of -1 the "-" is a mathematical operation forcing the 1 to be a number (negative number) which is not allowed by Console_WriteLine
but interestingly
'---Load Console Module
Uses "Console"
Long A,B
A=-1
B= 2
'---Print the magic words
Console_WriteLine A+2
PrintL "Press a key to end program"
'---Wait for a key press
WaitKey
will output -12 so it seems Console_WriteLine converts the contents of A to string so string -1 & string 2 = -12
ErosOlmi
12-11-2017, 13:41
Ciao,
Console_WriteLn or PrintL (are the same function) before printing they go ahead in parsing trying to understand if next token is a start of a numeric or string expression. Based on that result, it evaluates string expression or numeric expression.
Evidently it does a poor determination.
To be always in the right track, use STR$() or TSTR$() or FORMAT$() or any function reading a numeric expression returning its value as a string to print out numeric expressions.
Thanks for letting me know. I will see if I can improve kind determination.
Ciao
Eros