Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: Munchor on March 09, 2011, 05:35:58 pm

Title: NSpire Basic Arrays
Post by: Munchor on March 09, 2011, 05:35:58 pm
Hey there,

I was wondering if I have an array, how to add something to it:

Code: [Select]
{2,4,6,7,8,142}->myArray
Disp myArray
Disp myArray.count()

I want to add the number 666 to my array how can I do it?

Thanks.
Title: Re: NSpire Basic Arrays
Post by: willrandship on March 09, 2011, 05:50:20 pm
In the program, right? :P I think array + {666} should work as an append-style function, but it might not, I'm not sure. I know it does in python and might in C++
Title: Re: NSpire Basic Arrays
Post by: Goplat on March 09, 2011, 05:57:24 pm
I think what you're looking for is augment(myArray,{666}).
A way to do it "in-place" is 666→myArray[7]. This might be faster, but I haven't tested.
Title: Re: NSpire Basic Arrays
Post by: Munchor on March 09, 2011, 05:58:36 pm
myArray[7] won't work, I tested it.
Title: Re: NSpire Basic Arrays
Post by: Goplat on March 09, 2011, 06:18:05 pm
It worked when I tested it. What OS are you using? (I have 2.0.1)
Title: Re: NSpire Basic Arrays
Post by: Munchor on March 09, 2011, 06:20:53 pm
It worked when I tested it. What OS are you using? (I have 2.0.1)

I have the same OS, but I did something different, thanks!