Word doen't work. How come?

Just starting out? Need help? Post your questions and find answers here.
Randy Walker
Addict
Addict
Posts: 1109
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Word doen't work. How come?

Post by Randy Walker »

This renders zero in both PB ver 5.40 and ver 6.20 :cry:

Code: Select all

Xit1.W = 33
Debug Xit.W
So why does Debug not give me 33 ?
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Randy Walker
Addict
Addict
Posts: 1109
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: Word doen't work. How come?

Post by Randy Walker »

Haha haaa I'm such an idiot -- Total I/O error.
Xit1 <> Xit (Duuhhhh) :oops:
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Little John
Addict
Addict
Posts: 4803
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Word doen't work. How come?

Post by Little John »

Use EnableExplicit to avoid mistakes like that.
Randy Walker
Addict
Addict
Posts: 1109
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: Word doen't work. How come?

Post by Randy Walker »

Little John wrote: Sun Dec 22, 2024 1:18 am Use EnableExplicit to avoid mistakes like that.
Yeah, I tried that but EnableExplicit causes me too much confusion.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Word doen't work. How come?

Post by DarkDragon »

Randy Walker wrote: Sun Dec 22, 2024 1:42 am
Little John wrote: Sun Dec 22, 2024 1:18 am Use EnableExplicit to avoid mistakes like that.
Yeah, I tried that but EnableExplicit causes me too much confusion.
Not having EnableExplicit confused you, too. It just requires you to declare variables correctly.
bye,
Daniel
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Word doen't work. How come?

Post by Quin »

Yeah, Explicit made using PB way nicer for me. Once you get used to it it's fairly simple, you just have to declare all your variables before you use them. For globals this is super simple:

Code: Select all

Global X = 10
In procedures, you use Protected, and I personally tend to declare all needed variables right at the top of the function to avoid scope weirdness:

Code: Select all

Procedure Test()
Protected I, Ret$,
For I = 0 To 10
Ret$ + "meow"
Next
Debug Ret$
EndProcedure
The only thing this makes slightly less convenient are for loops, which is why I really want the := operator, so we can go:

Code: Select all

For I := 0 To 10
Or even:

Code: Select all

For Protected I = 0 To 10
Post Reply