here's the code with the loop:

: Repeat C<1
: 0→D
: Disp E
: Disp AB
: Disp A(B+1)
: Input "TIME=",C
: Repeat C=D
: A(B+1)→A
: D+1→D
: 1+E→E
: End
: End
What are you entering for C when you get prompted?
an interger

I want it so if you post 0 (or anything else), it quits the program
Repeat will always run the contents within the loop at least once, so if you're entering in "0" this will loop forever. Try refactoring the loop to be a while loop instead and see if that works out (While C!=D). Note, though, that that won't work with negatives, either, because then C will never equal D, so you might want While C!=D and C>0.
FrozenFire49 wrote:
an interger


As a possibly helpful unrelated note, the word is "integer". I'm not sure if this was a typo or proper misspelling, but I've heard enough people pronounce it that way that I thought I'd point out the correct version just in case.

[edit]

Nevermind, I see from SAX that you caught yourself. As a different possibly helpful note, you should know that you can edit your post to cover up little mistakes like that if you notice them after posting.
I just typed up your code and tested it. Your Repeat C<1 will loop for a positive C. The other one will loop for a negative or 0 C. If you want it to always quit, you shouldn't have the Repeat C<1. If you want it to quit only when C=<1, you need an additional conditional on your inner loop. This code runs once and then quits:

Code:
: 0→D
: Disp E
: Disp AB
: Disp A(B+1)
: Input "TIME=",C
: Repeat C=D or C<1
: A(B+1)→A
: D+1→D
: 1+E→E
: End
One more thing that causes the loop, when decimals are imputed. Is there a command that will only take integers?
FrozenFire49 wrote:
One more thing that causes the loop, when decimals are imputed. Is there a command that will only take integers?
No. Your options would be to write an input routine of your own using getKey, or use the int() or iPart() commands after getting a number from the user.
Couldn't I just use the getKey to disable the decimal or restart the loop when the decimal is pressed?
You asked about lists/variables in sax and here's a summary of lists.

All tokens can be found by press 2nd STAT then right


5->dim(LNUMS

This creates a list named NUMS that has 5 elements, if I were to replace 5 with 7 it would have 7 elements.

An element can be a positive or negative number and you can have as many as your ram allows.

To access numbers in a list you put the numbers address like so.

Code:
LNUMS(1)

This gets the first number in the list, if i were to replace 1 with 2 it would get the second number in the list, and so on for as many elements as you define with 'X->dim(LNUMS'

These addresses are used to store and read from

Ex

Code:
Disp LNUMS(1)

Displays the first element in the list NUMS

Code:
20->LNUMS(1)

sets the first element in the list NUMS to 20

You must always define a list using dim( before it can be used, you can check if a list exists by pressing 2nd then stat and you will see a list of existing lists.

For example if i had not defined LSCORE and i tried to use it, it would give me an error


Code:
Disp LSCORE(1)


instead you want to define it first

Code:
1->dim(LSCORE
Disp LSCORE(1)


Note that something like

Code:
Input "N:",LNUMS
would not work and you instead would have to do
Code:
Input "N:",X
X->LNUMS(1)

instead

also note that you must use the L at the bottom in the ops part of the list menu at 2nd STAT to define and reference lists.

Other commands you can use in the ops tab are

SortA(List -Sorts list elements in ascending order of value

SortD(List -SortA but descending

dim(List -used to define lists and returns how many elements are in a list

Fill(Num,List - Fills a list with a number.
Are lower case variables their own variables or do they act as their uppercase counterparts?
the lowercase gives you an error idk why though
FrozenFire49 wrote:
Are lower case variables their own variables or do they act as their uppercase counterparts?
There's no such thing as lowercase variables; trying to use a lowercase letter as a variable will cause a Syntax Error. The exception are some of the statistics (a, b, c, d, e from the VARS -> 5 menu) and u/v/w variables.
  
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