Dim Error on empty List
5 posts
• Page 1 of 1
- brickviking
- Member
- Posts: 27
- Joined: Fri Aug 28, 2015 5:10 am
- Calculators: Casio fx-9750G PLUS, Casio fx-9750GII (SH4)
Dim Error on empty List
I've found one small bug or lack of functionality, with no real way to work around it. If a List happens to be empty (no values), and I try retrieving any information about that list from within a program (Dim List n), I get Dimension Error on the fx-9860GII (or simply Dim Error on the fx-9750G+). I can't test for a non-present list without running into the aforementioned Dimension Error. Does anyone know a way around this?
(Post 12)
(Post 12)
Regards, BrickViking
Re: Dim Error on empty List
There is a trick on fx-9860G/GII and FX 1.0/2.0 models:
10->Z // expected list size
Getkey=79=>Z->Dim List 1 // initial setup
Z->List 1[1] // overwrite or create first cell
Dim List 1=/=List 1[1]=>"Error"
So the first list cell cannot be used and is always overwritten.
I would also recommend to store a magic number or checksum in the last list cell, in case there is another list with the same size but incompatible data.
10->Z // expected list size
Getkey=79=>Z->Dim List 1 // initial setup
Z->List 1[1] // overwrite or create first cell
Dim List 1=/=List 1[1]=>"Error"
So the first list cell cannot be used and is always overwritten.
I would also recommend to store a magic number or checksum in the last list cell, in case there is another list with the same size but incompatible data.
Last edited by TeamFX on Fri Sep 25, 2015 5:26 pm, edited 1 time in total.
Re: Dim Error on empty List
If you're interested in Casio-Basic programming, have a look here for more tricks:
http://community.casiocalc.org/topic/54 ... -from-cfxm
Last post contains the corrected Omnimaga links.
http://community.casiocalc.org/topic/54 ... -from-cfxm
Last post contains the corrected Omnimaga links.
- brickviking
- Member
- Posts: 27
- Joined: Fri Aug 28, 2015 5:10 am
- Calculators: Casio fx-9750G PLUS, Casio fx-9750GII (SH4)
Re: Dim Error on empty List
TeamFX wrote:There is a trick on fx-9860G/GII and FX 1.0/2.0 models:
10->Z // expected list size
Getkey==79=>Z->Dim List 1 // initial setup
Z->List 1[1] // overwrite or create first cell
Dim List 1=/=List 1[1]=>"Error"
So the first list cell cannot be used and is always overwritten.
I would also recommend to store a magic number or checksum in the last list cell, in case there is another list with the same size but incompatible data.
Um, I'm confused, so I've got some questions.
- What's the GetKey for?
- Is =/= actually [NOT EQUAL] and == is [EQUAL]?
- And, does this count on me having a List element 0 assigned for the expected list?
- One last thing, will this work on a fx9750G+, or just the fx9860G/GII ?
(Post 13)
Regards, BrickViking
Re: Dim Error on empty List
What's the GetKey for?
Go to the PRGM menu and start your program by pressing [F1].
[F1] is often used for setup/installation purposes in Casio-Basic programs.
=/= is the unequal sign.
== was C syntax, I fixed that.
List 1[0] can contain a subject name but it doesn't matter if there is one or not.
"Stuff"->List 1[0] will also create List 1[1] if the list did not exist.
This will not work on an fx-9750G or CFX.
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 40 guests