Yeah, kicking this off- I'm having trouble with the Menu() command. Am I doing this wrong?


Code:
Menu("MENU","X",X,"Y",Y)
:Lbl X
:Disp 0
Return
:Lbl Y
:Disp 1


Selecting option Y will throw an ERR:LABEL.

Alternatively, if I do away with the Return command, selecting option X will display both 0 and 1 respectively.

what do?
M. I. Wright wrote:
Selecting option Y will throw an ERR:LABEL.
I see no reason why that would happen. There must be something else wrong with your program. Are you sure you transcribed it accurately from your calculator?
Works for me. I can't understand why it doesn't work.
Are you separating your lines with a colon, or a new line? You are definitely going to get that error if that is the case... Confused

As for it displaying both, that is how the goto works. You can take a look at that link I gave you for a workaround to it. Smile
MateoConLechuga wrote:
Are you separating your lines with a colon, or a new line? You are definitely going to get that error if that is the case... Confused
It will be equally fine with a colon; this code works as well:
Code:
:Menu("MENU","X",X,"Y",Y)
:Lbl X
:Disp 0
:Return:Lbl Y
:Disp 1
Yes, I know that this doesn't solve the Y label problem, but this code will fail:

Code:
:Menu("MENU","X",X,"Y",Y):Lbl X
:Disp 0
:Return
:Lbl Y
:Disp 1


When selecting Lbl X. Interesting note. Razz

EDIT: Sorry Kerm, I should have been more clear... I kind of meant the whole thing was on one line. Razz
Unicorn wrote:
Works for me. I can't understand why it doesn't work.


KermMartian wrote:
M. I. Wright wrote:
Selecting option Y will throw an ERR:LABEL.
I see no reason why that would happen. There must be something else wrong with your program. Are you sure you transcribed it accurately from your calculator?


I went to sleep last night before I saw any of these responses, but when I woke up and saw this I figured that something was wrong with my calculator because there's no way I could've entered the code wrong, right?



...on second thought, I'll look back at the code I put in the calculator.


Code:
Menu("MENU","X",X,"Y",Y)
Lbl X
Disp 0
Return
Lbl A
Disp 1

Well then.
Yes, I imagine that that would do it as well. Razz Oh well. Smile Glad you got it figured out! Smile
This isn't really urgent, but I have this code:


Code:
ClrHome
"E"→F
"F"→G
randInt(1,2)→A
randInt(1,2
Output(1(Ans=1)+2(Ans=2),1(A=1)+2(A=2),F(A=1)+G(A=Ans)


I wrote it (originally with numbers stored to F and G) to learn about piecewise functions, but when I modified it to do this it now outputs random (?) numbers at the four possible coordinates. The numbers outputted seem to change by day- here are the outputs I've gotten so far:
(the numbers don't appear at the same time, of course)

Day 1:

Code:
7 0
2 5

Day 2:

Code:
10 0
2 5

Day 3:

Code:
9 0
2 7


why does this happen?
Honestly, I don't believe that there is any true correlation. I believe it is based off a seed value most of the time, and only uses the clock sparingly, but I would need to verify this. One thing that you might want to experiment with is putting this at the beginning of your code:

Code:
5->rand

You will notice that you consistently get the same values because you are seeding the random variable generator; this method could be useful for creating passwords and things. Hope this clears up some things! Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement