We haven't reached a complete consensus on whether or not Ans is permitted as a valid input format for TI-BASIC.

We have this answer on "Default for Code Golf: Input/Output methods" with a slim majority support for its use, but I recently posted an answer to Approximation of e which used Ans as input, receiving a large amount of dispute over the matter.

The previous meta post answer also cites another TI answer using Ans that was questioned heavily. Though that should prohibit the use of Ans, some have stated that Ans has historically been used without issue.

So is Ans permitted as a valid form of input, or not?

  • 3
    \$\begingroup\$ As you stated, there is already an answer on the I/O methods post. That answer lacks significant support to be considered consensus, so it's not an acceptable method. \$\endgroup\$
    – user45941
    Jun 13, 2016 at 2:26

1 Answer 1


Yes, it is a valid form of input

While TI-BASIC does not come with any sort of function, they can be faked. I use this approach often when making a program that is repeated multiple times by a parent program. By using the value of Ans, one can transform Ans into another value and leave it as Ans. Say we wanted to write a "function" that takes the sign of the number (not golfing, here)

If A<0:-1
If A=0:0
If A>0:1

Then, from a parent program:

Input "NUMBER=",B
Output(2,1,"Sign of B=

As such, it is often more useful to other programs to take input in the form of Ans. While it is not a true function, it is the closest TI-BASIC can get. Therefore, being a "function", Ans should be valid input.

  • \$\begingroup\$ Please refrain from answering obvious duplicate questions, especially with incorrect answers. It's clear from the dupe target that Ans is not an acceptable form of input. \$\endgroup\$
    – user45941
    Jun 14, 2016 at 22:51
  • \$\begingroup\$ The answer on the dupe target has +14/-10. The rule is net +5 and at least twice as many upvotes as downvotes to be a valid form of input. It fails on both criteria. You may personally think that it is a valid form of input, but it is clear that the community disagrees. \$\endgroup\$
    – user45941
    Jun 14, 2016 at 23:01
  • \$\begingroup\$ @Mego Alright, what would happen if somebody posted an answer "No, last expression is not valid input." It would likely have something like a +10/-14, judging from the votes on the dupe target. Still no clear consensus, yet you clearly think there is some compelling reason to go the other way. \$\endgroup\$ Jun 14, 2016 at 23:05
  • \$\begingroup\$ The defaults post is a whitelist. By community consensus, if an I/O method does not fulfill the requirements, it is not valid. Had it been created as a blacklist (like the standard loopholes post), the situation would be different. \$\endgroup\$
    – user45941
    Jun 14, 2016 at 23:07
  • \$\begingroup\$ @Mego Conceded. \$\endgroup\$ Jun 14, 2016 at 23:13

Not the answer you're looking for? Browse other questions tagged .