Difference between revisions of "TI-BASIC:Number Or String"
From Learn @ Cemetech
Jump to navigationJump to search (Initial automated import) |
(Automated @@ correction) |
||
Line 1: | Line 1: | ||
{{Template:TI-BASIC:Routine | {{Template:TI-BASIC:Routine | ||
− | |picture= | + | |picture= |
|summary=Determines whether an input is a number or string. | |summary=Determines whether an input is a number or string. | ||
|input=''Ans'' - the number or string to examine | |input=''Ans'' - the number or string to examine | ||
Line 7: | Line 7: | ||
|compatibility= TI-83/84/+/SE | |compatibility= TI-83/84/+/SE | ||
|author=bfr | |author=bfr | ||
− | |authors= | + | |authors= |
|url=http://www.unitedti.org/forum/index.php?showtopic=9191 | |url=http://www.unitedti.org/forum/index.php?showtopic=9191 | ||
|download=http://tibasicdev.wikidot.com/local--files/routine-page/routine.zip routine.zip | |download=http://tibasicdev.wikidot.com/local--files/routine-page/routine.zip routine.zip |
Latest revision as of 22:12, 24 February 2016
Routine Summary
Determines whether an input is a number or string.
Inputs
Ans - the number or string to examine
Outputs
Ans - 1 if the input is a number, 0 if it is a string
Variables Used
A, B [,∟A, ∟B if input is a string]
Calculator Compatibility
TI-83/84/+/SE Author
bfrURL: [1] Download
:DelVar AFor(B,1,1 :Ans->A :Ans->B :A=B
If Ans is a string, it is stored to ∟A and ∟B. A remains 0, B remains 1, and A=B returns false. If Ans is a number, it is stored into both A and B, thus A=B returns true.
The For( command is used to avoid updating Ans. If this routine is used in a larger program and the input can be stored into a more permanent variable, For(B,1,1 can become 1->B. If this is not possible, the For( statement should have an End added.