Page 1 of 1
Don't know how to title this...
Posted: Sat Jun 01, 2024 12:54 am
by jacdelad
This doesn't throw an error:
Code: Select all
EnableExplicit
Define myvar.s=myvar
Debug myvar
But, should it?
Re: Don't know how to title this...
Posted: Sat Jun 01, 2024 1:26 am
by boddhi
That seems logical to me.
If we analyze the line sequentially, the declaration (Define) is made before the assignation (=).
So, the variable already exists before being used as the value to be retrieved.
Re: Don't know how to title this...
Posted: Sat Jun 01, 2024 2:33 am
by jacdelad
Ok, thanks. I wasn't sure.
Re: Don't know how to title this...
Posted: Sat Jun 01, 2024 9:57 am
by Little John
jacdelad wrote: Sat Jun 01, 2024 12:54 am
This doesn't throw an error:
[...]
But, should it?
Yes, it should throw an error.
Because on the 2nd line, the same variable is used as an integer and also as a string.That doesn't make sense.
Re: Don't know how to title this...
Posted: Sat Jun 01, 2024 10:33 am
by mk-soft
Little John wrote: Sat Jun 01, 2024 9:57 am
jacdelad wrote: Sat Jun 01, 2024 12:54 am
This doesn't throw an error:
[...]
But, should it?
Yes, it should throw an error.
Because on the 2nd line, the same variable is used as an integer and also as a string.That doesn't make sense.
What makes you think that it is an integer variable? That is not correct
Code shown slightly differently
Code: Select all
EnableExplicit
Define myvar.s
myvar=myvar
Debug myvar
PB checks syntax errors and not logic errors

Re: Don't know how to title this...
Posted: Sat Jun 01, 2024 10:49 am
by Little John
mk-soft wrote: Sat Jun 01, 2024 10:33 am
What makes you think that it is an integer variable? That is not correct
Oops! Yes, you are right.
Re: Don't know how to title this...
Posted: Sat Jun 01, 2024 10:30 pm
by jacdelad
Thanks you all. I just was somehow confused (the code doesn't make sense anyway).