PB4 - what´s wrong?

Just starting out? Need help? Post your questions and find answers here.
denise_amiga
New User
New User
Posts: 7
Joined: Fri Sep 09, 2005 5:27 pm

PB4 - what´s wrong?

Post by denise_amiga »

Code: Select all

tst=0
Debug tst+1
Debug tst+1
Debug tst+1
result:
1
1
1
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Code: Select all

tst=0

tst+1
Debug tst

tst+1
Debug tst

tst+1
Debug tst
--Kale

Image
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: PB4 - what´s wrong?

Post by Psychophanta »

denise_amiga wrote:

Code: Select all

tst=0
Debug tst+1
Debug tst+1
Debug tst+1
result:
1
1
1
What's wrong?
That's what i say.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

cat = 1
dog = cat+1
debug cat ; it would be a big problem if this were now 2 as a result of the last operation.

I believe cat+1 would have to be alone on its own line for cat to be modified.
BERESHEIT
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

x+1 increases x in 1

debug x+1 just prints (x + 1) and does not increase it, because the debug command has priority and the result is not considered an operation just a print out of X variable + 1...
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Hi, num3, not every times you are so explicit and gentlemen :P
Is it because Denise is a lady name?
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

x+1 alone on one line is just a typo for x=x+1
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

well i wouldn't call x+1 a TYPO for x=x+1 :-)

and yeah, that debugger behaviour threw me of balance as well, but it makes sense: your program's behaviour should not change when you switch the debugger on or off, so if anything behind a 'debug' command is ignored, then that would make sense... kind of :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
denise_amiga
New User
New User
Posts: 7
Joined: Fri Sep 09, 2005 5:27 pm

Post by denise_amiga »

Num3 wrote:x+1 increases x in 1

debug x+1 just prints (x + 1) and does not increase it, because the debug command has priority and the result is not considered an operation just a print out of X variable + 1...
ok, and thx
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

LOL Denise is a lady name for sure, but it's also a chip name :P from AMIGA !

Upsss....

Image
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Num3 wrote:LOL Denise is a lady name for sure, but it's also a chip name :P from AMIGA !
Yeah! the main VDP chip which controls the amiga sprites, etc.
Nice .gif 8)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply