For my new, probably my biggest program to date, I have a menu using Text( and getKey to make is more appealing. I need it to be able to only stop doing:

Code:
Repeat Ans!=0
getKey
End

when only specific buttons are pressed. The buttons that I only want are the letters A-L. My first idea was to use a list to do it, but that didn't work. Could I use a string to do it?

Please note that the code above is just an example and not the code I am using

Edit: I found out to do it, I did:

Code:
Repeat inString(Str1,Str2)!=0
getKey->K
{0,1->L1
{0,K->L2
LinReg(ax+b) {Y1}
Equ>String({Y1},Str2
sub(Str2,1,length(Str2)-3->Str2
End
Your code on the bottom is way over complicated. If I understand you right, you want to exit the repeat loop if any button between letters A and L (between "MATH" and ")".

So a very simple way to do this would be:

Code:

Repeat Ans≥41 and Ans≤64 and sum(Ans≠{44,45   //alternatively, you could do "Ans≠44 and Ans≠45"
getKey->K   //incase you want to use K later, you would want to store the getKey value
End

The loop will break only if the user presses a button between A and L.
I guess it doesn't really matter except for the learning experience, but here's my optimization of your earlier code:

Code:
Repeat not(inString(Str1,Str2
getKey
{0,Ans->L2
{0,1->L1
LinReg(ax+b) {Y1}
Equ>String({Y1},Str2
sub(Str2,1,length(Str2)-3->Str2
End
thx, I guess I should have thought of that first

Edit:
Michael2_3B wrote:
Your code on the bottom is way over complicated. If I understand you right, you want to exit the repeat loop if any button between letters A and L (between "MATH" and ")".

So a very simple way to do this would be:

Code:

Repeat Ans≥41 and Ans≤64 and sum(Ans≠{44,45   //alternatively, you could do "Ans≠44 and Ans≠45"
getKey->K   //incase you want to use K later, you would want to store the getKey value
End

The loop will break only if the user presses a button between A and L.

I added that into SourceCoder, and it gave a Syntax Error
that's because I used special characters, which don't work in Source Coder.

In Source Coder:
≥ should be >=

≤ should be <=

≠ should be !=
And I have that, but it give a syntax error, this is what I have in the coder:

Code:
Repeat K>=41 and K<=64 and K!=44 and K!=45
getKey->K
End
That code looks fine to me... What is giving you a syntax error? The check key in source coder itself or jsTIfied or what?
the check button in source coder will always say "it may or may not have correct language syntax", btw.
It is in jsTIfied. When I push "Goto", it stops on the end portion of the code above
I have no idea, but make sure the "End" is the actual End token, and not "E-n-d" (spelled out)
Ok, I figured it out. When I copied the code over, there was a space after the End token
I'm late, but

Code:
Repeat K>=41 and K<=64 and K!=44 and K!=45

//can be optimized to
Repeat K>=41 and K<=64 and int(.5K-22
  
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