Jump to content



Photo
- - - - -

Goto Variable


  • Please log in to reply
3 replies to this topic

#1 ericlegomeer

ericlegomeer

    Newbie

  • Members
  • Pip
  • 7 posts
  • Gender:Male
  • Location:127.0.0.1 :P

  • Calculators:
    fx-82MS
    fx-82ES
    fx-9860G

Posted 31 August 2008 - 10:37 AM

Hi,

Yesterday I made an account on this forum because I had a problem... After some thinking I solved it myself... Now I've got a new problem and I hope someone can help me.

What I want to do is something like this:

1 :arrow: A :newline:
Goto 2 :newline:
Lbl 1 :newline:
Locate 1,1,"This is label 1" :newline:
Lbl 2 :newline:
Goto A :newline:

The problem is that you can also use 'A' as a label name. So you'd get an Go Error when you'd start this code.

Now what you could do is make a long piece a code which will check if the variable A is 1,2,3... or 9 and then go to that label, but it has to be easier... Does someone know how??


Eric

PS is there somewhere a switch statement in the program functions?

#2 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 01 September 2008 - 09:56 PM

Hello ericlegomeer and welcome to the forum! :D

According to your other thread, you have solved this problem, right? If so, you may want to post your solution here so others who are curious can learn also.

#3 ericlegomeer

ericlegomeer

    Newbie

  • Members
  • Pip
  • 7 posts
  • Gender:Male
  • Location:127.0.0.1 :P

  • Calculators:
    fx-82MS
    fx-82ES
    fx-9860G

Posted 02 September 2008 - 05:40 AM

Well, the only answer I could come up with is something like this:

If A=1
Then Goto 1
Else If A=2
Then Goto 2
Else If A=3
Then Goto 3

But there has to be a better way...

Maybe I can store the number somewhere else, and then recall it :greengrin: ...
I'll keep trying, when I have finished it I'll post the answer, but for now on it's just a log piece a code...


Eric

#4 Somelauw

Somelauw

    Newbie

  • Members
  • Pip
  • 14 posts

  • Calculators:
    Casio CFX-9850GC PLUS

Posted 08 September 2008 - 02:43 PM

Best way (in my opinion):
while 1 //main

while a = 1
...
whileend

while a = 2
...
whileend

a = 1
whileend //to main

I don't know exactly what you want to do. But I like to avoid goto and lbls as much as possible because they confuse the heck outa me.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users