Code:

code code code....bla bla
something=something..

Disp "1.",D
Disp "2.",B
Disp "3.",C
While 1
Input "Smallest Number",I
If I=1
Then
I->D
If I=2
Then
I=B
If I=3
Then
I->A
End
It'd be awesome to know what you are trying to accomplish.

Right off the bat:

Those If:Then:Code can be IF:Code, you can skip the Thens if you only have one line of executable code.


Code:
code code code....bla bla
something=something..

Disp "1.",D
Disp "2.",B
Disp "3.",C
While 1
Input "Smallest Number",I
If I=1
I->D
If I=2
I=B
If I=3
I->A
End
Doesn't seem to work.

Keeps on repeating "smallest number"

and if I add another "End" , it will stay stuck

Code:
Disp "1.",D 
Disp "2.",B 
Disp "3.",C 
While 1 
Input "Smallest Number",I 
If I=1
I->D 
If I=2
I=B 
If I=3 
I->A 
End


Well. Here is your code again. You basically have an infinite loop. While 1. While 1 what? While 1=9? While 1=C? 1 is unchanging, and thus 1 will always be true. Now, you could do While A. If A is defined, it's 1 and true. If A is undefined, it's 0 and false. The loop will only continue while the criteria is true. You could do While not(A, so that way the loop quits only if A becomes defined.

That infinite loop is why you keep getting the smallest number prompt. You need to find a way to end the loop.
Fix the typos in your code, xologist. At the moment, it's nonsensical.
Please also edit the first post and the title of the topic to make it clear what you're actually trying to do.
comicIDIOT wrote:
It'd be awesome to know what you are trying to accomplish.


KermMartian wrote:
Please also edit the first post and the title of the topic to make it clear what you're actually trying to do.


We can't help you if you don't help us; contrary, I don't see any typos unless Weregoose is referring to a non-traditional typo, here it would be the infinite loop. I find it best to figure out a way to properly leave the loop and then work on optimizing it. Which, I think is better left for the end so you aren't trying to understand two things at the same time.

If you need some more help understanding While loops, that's fine and I'll be happy to help but I'm not going to provide you the answer to your problem. If you get it close, however, I'll show you and hopefully you'll be able to discern your mistake(s) by comparing the two.
xologist wrote:
and if I add another "End" , it will stay stuck

In a scene featuring the parser and If-Then-End, the parser floats about in a bubble and encounters a smaller pocket bubble, which it may only penetrate provisionally. If it may enter, then it plunges in, undergoes a mini-exploration, then ends its trip by slipping back into the outer bubble from whence it came. Is your parser entering and escaping these sub-bubbles in an order which makes sense (chrono-)logically?

@comicIDIOT: I'm fairly sure his I→A was to be an I→C (and his I=B an I→B), but I like to make-believe that we're not mind-readers.
Oh man. I totally overlooked those.
  
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