Home TI-Nspire Authoring Getting Started with TI-Nspire Programs


Getting Started with TI-Nspire Programs

TNS sampler documents


Under the 2.0 release, programming on the TI-Nspire platform has gained great new functionality in the form of dialog boxes for display and input. Using the "Text" "Request" mad "RequestStr" we can now engage students interactively in a "safe" environment which completely restricts the opportunities for users to "mess up" the prepared document.

The videos here show some of this functionality in action. The context is a simple numerical exercise which supports students in learning how to work with integer addition and subtraction.

Program: Step 1: Simple Display

Back to Top

Begin by defining a new program using the Program Editor. Any variables we define would generally be defined as "Local" so that they do not survive after running the program. In this example, we define random numbers as the two components of our example question.

We want our sign (+ or -) to be randomly chosen, so an "If..Then..Else..EndIf" statement will provide this along with a RandInt(0,1) output. This gives a 50/50 chance of each. If we wanted "+", for example, to be more likely, then we could use something like RandInt(0,3)>0. This would make the chance three times more likely.

The "Text" statement takes strings as input, and we can join these together using the "&". In this case, we turn the numbers "a" and "x" into strings using "string(a)" and "string(x)".

Suppose we want to evaluate a string: for example, string(a)&sign1&string(x) might output as "-2+3". Use the "expr()" command to evaluate such a valid string: expr("-2+3")=-1. The output of the expire command is a number; the output of the string command is a string.

Program: Step 2: First Interaction

Back to Top

In this next step, we introduce the "Request" statement. As shown, this statement displays a prompt and waits for a response, which is labelled as a variable. Here we ask students to enter the answer to the random question. The response is compared to the correct answer using an "If..Then..Else..EndIf" block.

This works well for simple right/wrong questions and answers. The final steps show how easily this can be extended to allow students to make one mistake and be given a second chance.

Program: Step 3: More Detailed Question

Back to Top

Next we go back to the original challenge - for students to combine and simplify mixed signs, but first we need to add the positive sign to those numbers greater than (or equal to) 0. This involves setting up a new question (used for display) and a new answer.

Program: Step 4: Asking the Right Question

Back to Top

Now we meet the powerful "RequestStr" command. Like "Request" it prompts with a text question and accepts an input, but this time the input is a string instead of a number. We would like the input to be the simplified version of our new question: so, for "2-(+3)" we want the student to enter "2-3" and have this checked.

Program: Step 5: Housekeeping

Back to Top

We have all the ingredients we need. We just need to ensure that the right questions are being asked and the right answers being checked.

Program: Step 6: Finishing Touches

Back to Top

There are some neat ways that we can enhance our program. These include inserting a comment at the beginning, which will appear when the program is viewed in the Catalog.

One of the best neat tricks involves the "Try..Else..EndTry" block. This removes the danger of students doing something wrong and being confronted with an error message that offers to take them to the program for editing! We don't want this to happen, so we wrap our program in a Try block and if anything goes wrong, it just drops out.

Finally, we can ask if they want another question - if so, we just run the program again.


©2009 Compass Learning TechnologiesHome TI-Nspire Authoring Getting Started with TI-Nspire Programs