Revision deb2022b-726a-4734-a572-1dfcee97b086 - Code Golf Stack Exchange

# TI-BASIC
*[The language varies based on which calculator it is used on, but these will use the TI-84 unless otherwise noted.]*

### Length 17 snippet
 dbd(1.2711,1.2115
This calculates the number of days between two dates, in this case January 27, 2011, the day this site started, and January 21, 2015, the day this was written. (That's 1455 days for the lazy.) The way to encode dates is a little strange: either DDMM.YY or MM.DDYY, leading zeroes optional.

### Length 16 snippet
 For(A,0,5
 Disp A
This shows two parts of the programming side of the language. The first is your typical `for` loop, similar to `for(var A=0;a<5;a++)` in other languages. (You should also use the `End` command to break out of the loop.) The second is self-explanatory: it displays `A`, in this case 5 times because of the loop.

### Length 15 snippet
 Y1=|X³-4|
 Y2=3X
Here are two examples of a well-known feature of *graphing* calculators: graphing equations. You can have 10 different equations graphed on the same plane, and there are many useful commands to find intersections, maxima, values of *x*, etc.

### Length 14 snippet
 [[1,2][34,5]]T
The brackets are used to make matrices, and the <code><sup>T</sup></code> transposes the matrix:

 [[1 34]
 [2 5]]

### Length 13 snippet
 dayOfWk(9,1,6
This finds the day of the week of January 6, 9 AD. The output is a number where 1 is Sunday, 2 is Monday, and so on. This particular date was a Tuesday, so the output is `3`.

### Length 12 snippet
 Circle(1,3,5
The first of the basic drawing tools, this draws a circle on the graph with a center at (1,3) and a radius of 5.

### Length 11 snippet
 randInt(0,8
This generates a (pseudo-)random integer between 0 and 8 inclusive. There is an optional third argument that tells how many integers to generate. There are several other random functions: ones for normal and binomial distributions, one for a random matrix, and one for a randomly ordered list with no repetitions. `randInt` can be seeded by storing a number as `rand`: `2→rand`.

### Length 10 snippet
 4>5 or 2≠7
Here we have TI-BASIC's (in)equality and logic operators. The inequality statements evaluate first to `0 or 1`, and `or` returns true if either side is true, so this displays `1`.

### Length 9 snippet
 656▶F◀▶D
This can convert from decimal to fraction and vice versa, which is very useful. There are also dedicated `▶Frac` and `▶Dec` functions that only go one way. Prints `82/125` in this case.

### Length 8 snippet
 lcm(14,6
This prints the least common multiple of 14 and 6, which is 42.

### Length 7 snippet
 getDate
Pretty self-explanatory, just prints the current system date as a list, in this case `{2015 1 19}`.

### Length 6 snippet
 √({4,9
Arrays (or lists) are surrounded by braces and separated by commas. This is similar to the `map` function of many languages, where it iterates through each element of the list and applies the operation outside the braces to it, in this case square root, so the result is `{2 3}`. Note that closing parentheses are optional, so they will be omitted from now on.

### Length 5 snippet
 4iii6
We've got a couple of cool things going on here. First, the real parts, 4 and 6 are multiplied, and then the imaginary parts are multiplied: `i^3`, or `-i`. These multiplied give `-24i`. This showcases funky-looking juxtaposition multiplication and TI-BASIC's handling of imaginary numbers.

### Length 4 snippet
 8°5′
This is 8 degrees, 5 arcminutes, which is converted to degrees as `8.0333`...

### Length 3 snippet
 8→T
This shows how numbers can be stored as variables, which is somewhat unusual because the number goes first, followed by the store arrow, then the variable name. As mentioned in the factoid, `θ` (theta) can also be used as a variable, and variables can only be one uppercase letter.

### Length 2 snippet
 4M
Similarly to Mathematica, you can multiply with juxtaposition, no `*` necessary. All variables are initialized to 0 by default, so this will output 0 unless you have stored something else to that variable (see snippet 3).

### Length 1 snippet
 e
This is Euler's number, which displays as `2.718281828`. TI-BASIC also has the constant `π`, but that was used above.

### Factoid
Variables can only store certain datatypes. For example, `A` – `Z` (and <code>&theta;</code>) store numerical values, `str0` – `str9` store strings, and `[A]` – `[J]` store matrices (2-dimensional arrays).

AltStyle によって変換されたページ (->オリジナル) /