Just starting out? Need help? Post your questions and find answers here.
jacdelad
Addict
Posts: 2032 Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa
Post
by jacdelad » Sat Jun 01, 2024 12:54 am
This doesn't throw an error:
Code: Select all
EnableExplicit
Define myvar.s=myvar
Debug myvar
But, should it?
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
boddhi
Enthusiast
Posts: 524 Joined: Mon Nov 15, 2010 9:53 pm
Post
by boddhi » Sat Jun 01, 2024 1:26 am
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.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
jacdelad
Addict
Posts: 2032 Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa
Post
by jacdelad » Sat Jun 01, 2024 2:33 am
Ok, thanks. I wasn't sure.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Little John
Addict
Posts: 4804 Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany
Post
by Little John » 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.
mk-soft
Always Here
Posts: 6320 Joined: Fri May 12, 2006 6:51 pm
Location: Germany
Post
by mk-soft » Sat Jun 01, 2024 10:33 am
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
Little John
Addict
Posts: 4804 Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany
Post
by Little John » Sat Jun 01, 2024 10:49 am
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.
jacdelad
Addict
Posts: 2032 Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa
Post
by jacdelad » Sat Jun 01, 2024 10:30 pm
Thanks you all. I just was somehow confused (the code doesn't make sense anyway).
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD