No Error:
Code: Select all
b=456
A$="ERROR Line "+ b + " : [] () Mismatch "
Debug A$
Code: Select all
b=456
A$=b + "ERROR Line "+ b + " : [] () Mismatch "
Debug A$
so ?
Code: Select all
b=456
A$="ERROR Line "+ b + " : [] () Mismatch "
Debug A$
Code: Select all
b=456
A$=b + "ERROR Line "+ b + " : [] () Mismatch "
Debug A$
The string must come first before the concatenation operator for the number to not need Str(), Str() or StrD().With strings the '+' is also valid for combining the contents of two strings, where the result will be assigned to the string on the LHS with the '=' operator or will be directly stored into the string on the LHS. Numeric values are also accepted for combination with a string. It will behave like using Str(), Str() or StrD() with their defaults for the optional parameters
Code: Select all
;The following are all equivalent
V = 345
A$ = " Value = "
B$ = A$ + Str(V)
B$ = A$ + V
B$ = A$ + 345
Debug B$
; The following is not allowed because a string has to come first:
; B$ = V + A$;
;It can be written as follows:
B$ = Str(V) + A$
;or alternatively as
B$ = "" + V + A$
Debug B$Code: Select all
a=100
Debug "" + a + "% right"
Code: Select all
# abc = $ abc
# abc123 = $ 123abc
abc + # abc + # abc123 + 123 + $ 123abc
Code: Select all
abc $ = "aghf"
That's because in this case, there are no strings involved at all.
The $ is part of the string variable name, you can't put spaces within the identifier name, and there is no other valid way PB could interpret this. In some case like constants it might just work but is not defined or supported by the language.
so the space should not allow at all , or it will come to confuse if write code like that#NULL wrote: Tue Jan 21, 2025 10:20 amThe $ is part of the string variable name, you can't put spaces within the identifier name, and there is no other valid way PB could interpret this. In some case like constants it might just work but is not defined or supported by the language.
Code: Select all
Debug Bool(a < > b)
Debug Bool(a > = b)
Debug Bool(a = < b)
Debug Bool(a > > b)
Debug Bool(a < < b)

So what?moricode wrote: Tue Jan 21, 2025 10:35 am No error :
Error :Code: Select all
p **p p * *P
Code: Select all
P * * P ; Error
I agree than operands shouldn't be allowed with space when it's a 2 chars operand.moricode wrote: Tue Jan 21, 2025 11:54 am all no error:
Code: Select all
Debug Bool(a < > b) Debug Bool(a > = b) Debug Bool(a = < b) Debug Bool(a > > b) Debug Bool(a < < b)
oh yes, you are right , i agree with you , this is a good example to show you that , all previous post example should remove space and not allow extra space in the between , so it remain language consistency and readability, and reduce human errors .Little John wrote: Tue Jan 21, 2025 4:32 pmSo what?moricode wrote: Tue Jan 21, 2025 10:35 am No error :
Error :Code: Select all
p **p p * *P
Code: Select all
P * * P ; Error
p is an integer variable, *p is a pointer variable.
p **p ist the product of those variables, and so is p * *P.
P * * P is invalid syntax, because two consecutive multiplication signs are not allowed.