Don't know how to title this...

Just starting out? Need help? Post your questions and find answers here.
User avatar
jacdelad
Addict
Addict
Posts: 2032
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Don't know how to title this...

Post by jacdelad »

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
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: Don't know how to title this...

Post 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.
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...
User avatar
jacdelad
Addict
Addict
Posts: 2032
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Don't know how to title this...

Post by jacdelad »

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
Addict
Posts: 4803
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Don't know how to title this...

Post 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.
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Don't know how to title this...

Post 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 :mrgreen: :wink:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Little John
Addict
Addict
Posts: 4803
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Don't know how to title this...

Post 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.
User avatar
jacdelad
Addict
Addict
Posts: 2032
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: Don't know how to title this...

Post by jacdelad »

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
Post Reply