Re: A92: Help me


[Prev][Next][Index][Thread]

Re: A92: Help me




Another reason for this problem(test did not result in true or false) can be 
that you haven't used this variable yet:
For example:

prgm
if x<5 then
output 1,1,"Less than 5"
endif

and x doesn't exist yet (see variable link=2nd + or something)

than you get the error, what you can do is: 0->x or something in the start 
of your program, using 'Local x' won't work either.


You're welcome,

Wouter v.d. Put (woutput@hotmail.com owner of TI-83&TI-92+)


>From: "Robert E. Rothermel III" <cs4h@saintmail.net>
>Reply-To: assembly-92@lists.ticalc.org
>To: assembly-92@lists.ticalc.org
>Subject: Re: A92: Help me
>Date: Sat, 27 Jan 2001 10:20:37 -0500
>
>
> > Hey thanks for somebody resoponding. but yea i have and i though i had 
>it
> > until it wasnt working. liek isnt there another book i can buy por 
>somthing
> > that can explain it to to bone>,,i get an error saying the test didnt 
>not
> > prove to be true or false.. gees ok thank sbye
>
>First of all, the program isn't running because there's an error in the
>program somewhere. Second, you won't learn about fixing errors in nearly 
>any
>programming book, so don't bother. You only get that knowledge from
>experience.
>
>As for your error. A test is something like:
>
>     If x<5 then
>         disp "x is less than 5"
>     Endif
>
>Now, if the variable x is less than 5, "x is less than 5" will be 
>displayed.
>Now, let's say x does not equal a number, but a string. For example, if you
>type "My name"->x, and then run the above code, how can the calculator know 
>if
>"My name" is less than 5 or not? So the calculator responds with an error
>"Test did not prove true or false.": there's no way to compare the two.
>
>This is probably where your problem is. First off, how did you get the 
>input
>numbers? Usually when you input numbers into the calculator, they are 
>stored
>as strings. When you try to compare it to a number it won't work. The
>calculator needs to convert it to a number first. Say the program looks 
>like
>this:
>
>:prog1()
>:Prgm
>:InputStr "Enter x",x
>:If x<5 then
>:    x^2->x
>:Else
>:    x*5->x
>:EndIf
>:EndPrgm
>
>The program will give an error because if you enter 3 when it asks for x, x
>will equal "3", not 3. Change the program so that the calculator converts x 
>to
>a number before it compares it to 5:
>
>:prog1()
>:Prgm
>:InputStr "Enter x",x
>:expr(x)->x
>:If x<5 then
>:    x^2->x
>:Else
>:    x*5->x
>:EndIf
>:EndPrgm
>
>expr takes a string and tries to turn it into a number. -> stores it in x, 
>and
>then x equals 3, not "3". The program should run fine.
>
>Hope this helps. If it doesn't, you can e-mail me your program (if you 
>want)
>and I'll see if I can help.
>
>Robbie - aka CyberServant4Him
>http://sdf.lonestar.org/~cs4h/about_me.html
>
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.