RainyClouds
RainyClouds

Reputation: 1

Set value for multiple variables at once?

While programming a sample program in my TI-84 calculator, I was wondering if there were a way to initialize multiple variables to a single value in one line? I tried doing

0 -> A,B,C,D

However this did not work for the calculator. I know you can do each one on an individual line, but my question is, is it possible to initialize multiple variables to a single value at once in TI-BASIC?

Upvotes: 0

Views: 1479

Answers (2)

kamoroso94
kamoroso94

Reputation: 1735

No, you can't set multiple variables at once with one value. But if you just want them on the same line, you can use a colon like this 0→A:0→B. If you really feel like it, you could make another program that zeroes out every variable and just call it from within your program like this.

PROGRAM:ZERO
:0→A
:0→B
:0→C
...

PROGRAM:OTHER
:prgmZERO
...

Upvotes: 2

Timtech
Timtech

Reputation: 1274

No. You cannot initialize multiple variables to a single value at once in TI-Basic.

However, you can:

  1. Set all values in an array or matrix to the same value at once.
  2. Initialize variables to zero in three bytes instead of four using DelVar (variable) and then leaving off the following colon. For example, instead of doing :0->A:0->B:Disp A,B you can do :DelVar ADelVar BDisp A,B.
  3. Remember that uninitialized variables are treated as zero when first used.

Upvotes: 4

Related Questions