|
Post by Brandon Parker on Oct 11, 2021 21:00:31 GMT -5
I am not certain if this has been reported previously, but here is a bug with the ; as the concatenation operator in the conditional of an If...Then statement.
var$ = "[-]"
'This works... 'Notice the () around the right side of the (a = b) '(i.e. the b term is in parentheses) If (var$ = ("[";Trim$("- ");"]")) Then var$ = "-"
var$ = "[-]" 'This also works using the + concatenation operator 'with or without the spaces around the + operator If (var$ = "[" + Trim$("- ") + "]") Then var$ = "-"
var$ = "[-]" 'But, this dose not 'No parentheses around the b term If (var$ = "[";Trim$("- ");"]") Then var$ = "-"
{:0)
Brandon Parker
|
|
|
Post by tsh73 on Oct 12, 2021 3:08:10 GMT -5
I would say not a bug but priority difference (well, may be issue)
print "12"="1";"2" produces 02 - "=" executes first, gives False (0), then it get concatenated by (semicolon)
print "12"="1"+"2" produces 1 - first (+) concatenates, then (=) evaluates to True (1)
|
|
|
Post by Carl Gundel on Oct 12, 2021 6:36:50 GMT -5
I would say not a bug but priority difference (well, may be issue) print "12"="1";"2" produces 02 - "=" executes first, gives False (0), then it get concatenated by (semicolon) print "12"="1"+"2" produces 1 - first (+) concatenates, then (=) evaluates to True (1) I would say that it's a bug in the way that it doesn't present with a proper error or warning. LB5 does produce a type mismatch error in the compile. Liberty BASIC doesn't compile expressions the same way in PRINT statements as it does in other situations.
|
|
|
Post by tsh73 on Oct 12, 2021 7:50:07 GMT -5
we used to (semicolon) automatically convert stuff to text then necessary - so no type mismatch expected?
|
|
|
Post by Carl Gundel on Oct 12, 2021 7:55:39 GMT -5
we used to (semicolon) automatically convert stuff to text then necessary - so no type mismatch expected? It works properly in the PRINT statement where it was intended to work properly.  It works better in LB5 because it doesn't blow up with a meaningless error.
|
|
|
Post by tsh73 on Oct 12, 2021 8:07:56 GMT -5
(shame on me - I thought I understand the problem but I didn't actually RUN original code, so I didn't saw error message)
|
|