| Author |
Message |
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:08:08 pm Post subject: Err:Label, but why and where? |
|
|
The problem seems to have been solved, thanks to KermMartian.
Thank you
In my prime factorization program I keep getting an error label (some of the code is attached).
I can't figure out what the check syntax option says is wrong, and i don't know enough to identify the error myself.
Here's the code:
(ₒ means store)
:ClrHome
:Disp "Prime Factorization"
:prgmPQPV
:Input "Number=",A
:AₒB
:ClrHome
:If A>0 or A=int(A)
:Then
:Goto 00
:End
:Lbl 00
:If (A/2)=int(A/2)
:Then
:(Z+1)ₒZ
:(A/2)ₒA
:Goto 00
:End
:If (A/2)≠int(A/2)
:Then
:Goto 01
:End
:Stop
:Lbl 01
:If (A/3)=int(A/3)
:Then
:(Y+1)ₒY
:(A/3)ₒA
:Goto 01
:End
:If (A/3)≠int(A/3)
:Then
:Goto 02
:End
:Stop
:Lbl 02
....It continues like this, just interchange 3 for an appropriate prime and go one letter down in the alphabet for variable.
Last edited by justametrognome on 09 Jun 2007 10:31:40 pm; edited 1 time in total |
|
| Back to top |
|
|
Mexi1010
Power User

Joined: 06 Mar 2007 Posts: 492 Location: Home
|
Posted: 09 Jun 2007 09:10:41 pm Post subject: |
|
|
Err: Label just means you have some kind of a goto command with a lable that does not exist. _________________
  |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:11:27 pm Post subject: |
|
|
| I actually checked for that and couldn't find anything... |
|
| Back to top |
|
|
Mexi1010
Power User

Joined: 06 Mar 2007 Posts: 492 Location: Home
|
Posted: 09 Jun 2007 09:12:49 pm Post subject: |
|
|
When you get the error message there should be two optionis, click the second one and se what it takes you to in the code then post that line. _________________
  |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:14:15 pm Post subject: |
|
|
I didn't get the second option, just an ERR:LABEL
And I'm looking through it now in case i managed to miss a label |
|
| Back to top |
|
|
Pseudoprogrammer

Awesomesauce

Joined: 12 Dec 2006 Posts: 890
|
Posted: 09 Jun 2007 09:15:49 pm Post subject: |
|
|
| Double check all of your labels and gotos |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:20:47 pm Post subject: |
|
|
checked again...nothing I could see
(keep in mind, most of my programming knowledge has come from experimentation and the nice little explanation that the calculator itself possesses) |
|
| Back to top |
|
|
Harrierfalcon

Advanced Member

Joined: 15 Jan 2007 Posts: 224
|
Posted: 09 Jun 2007 09:24:45 pm Post subject: |
|
|
What's the code for prgmPQPV? _________________ I've given up trying to sync all of my sigs at once.
Go look at my UTI Profile and make my life easier. Thnx. |
|
| Back to top |
|
|
Pseudoprogrammer

Awesomesauce

Joined: 12 Dec 2006 Posts: 890
|
Posted: 09 Jun 2007 09:25:09 pm Post subject: |
|
|
| Can you PM me the full source? |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:29:19 pm Post subject: |
|
|
prgmPQPV
My clearing program. It clears all of my variables. Mainly because I can and so certain programs don't get confused.
My calculator is incompatible with any computer I have access to...So all I have is what I've posted.
But the primes go up to 83 and then I have various outputs like this:
:Output(2,1,"2^"
:Output(2,4,Z
and then i go down to the 7th row and go over. |
|
| Back to top |
|
|
Xphoenix

Member

Joined: 25 May 2007 Posts: 126 Location: North of the south pole... or is it south from the south pole...? Or east from the west pole?
|
Posted: 09 Jun 2007 09:30:22 pm Post subject: |
|
|
Remember, ERR:LABEL does not have a goto option, as mentioned in the security section of the BASIC-Dev.
Can I also see the source?
Defined in the manual, an ERR:LABEL occurs if, and only if, there is no Lbl with a corresponding Goto. Basically, there is a Goto <label name> w/o a Lbl <label name>.
Wait. What you posted is what you have, yet you have another program? _________________ → ÷ ∟ ≥ ≠ ≤ ± π Θ √ ≅ ℕ ∞ ∑ ► → ∟ ⌂ º ± Ω π
 |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:33:04 pm Post subject: |
|
|
No no no, I posted what I have of this program on the computer (which I had to type in).
I'm relatively new at programming.
I've just checked all of the labels, which I'll do again in about 5 minutes. |
|
| Back to top |
|
|
c_plus_plus
Newbie

Joined: 19 Jun 2006 Posts: 13
|
Posted: 09 Jun 2007 09:38:00 pm Post subject: |
|
|
| I have an Idea. maybe you mistyped one of your labels of goto's I thk you might have mistyped one of you 0's as an O. In case you couldn't tell the first is a zero the second is the letter O. |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 09:54:51 pm Post subject: |
|
|
looking through yet again...and I didn't switch any O's with 0's. That would mean extra keystrokes...
Is it my telling it to Goto X within Lbl X?
While I'm here:
couldn't I optimize this by getting rid of all of the stop commands and my
If (A/prime)doesn't equal int(A/prime)
Then
Goto next
End |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 09 Jun 2007 10:03:41 pm Post subject: |
|
|
1. Use http://sc.cemetech.net to generate code from your programs to post. It's easier for everyone.
2. Never, never ever EVER Goto out of a Then/End structure. It causes memory leaks and slows down your program.
3. Always use Return instead of Stop for compatibility
4. I'm fairly sure massive optimization can be done to that. If no one else beats me to it, I'll optimize it later. _________________
 |
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 10:10:11 pm Post subject: |
|
|
Not using the Goto within the loop doesnt seem to work. Or do I not even need goto's and label's in this at all?
My calculator and computer don't currently work together. I'm working on that too.
And you need to go and optimize it...I'm doing this to see if I can.
I am really a beginning programmer. I don't even know all of the commands or how to use them. |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
justametrognome
Newbie

Joined: 09 Jun 2007 Posts: 9
|
Posted: 09 Jun 2007 10:31:03 pm Post subject: |
|
|
Wow...it actually works now, thank you for listening and offering help.
I'll use those tutorials. Some structured education. That much I can handle.
Thank you very much.
(it looks like it was too long and a very confused program, now it's slightly less confused) |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55736 Location: Earth, Sol, Milky Way
|
Posted: 09 Jun 2007 10:34:06 pm Post subject: |
|
|
Post the code as you have it now? And please stick around for more help when you have questions; we're happy to assist.  _________________
 |
|
| Back to top |
|
|
Super Speler

Advanced Member

Joined: 12 Dec 2006 Posts: 248
|
Posted: 10 Jun 2007 09:49:43 am Post subject: |
|
|
| Oh, and the most complete TI-Basic tutorial site I have yet to come across: TI-Basic Developer |
|
| Back to top |
|
|
|