Code:

:If det(9,"NOTELIST")≠"rowSwap(NOTES
:Then
:det(0,"rowSwap(NOTES",5
:det(6,"rowSwap(NOTES","NOTELIST",1
:End


This following code checks if an AppVar has been created and if not, creates it. It checks for the AppVar by checking if its first line is "NOTELIST", if not it creates the AppVar and then adds NOTELIST to the first line.

This should work fine, but for some reason every time I run my program this code gets executed. The line "NOTELIST" is added to the AppVar every time. I've created another program with the following code:


Code:

:Disp det(9,"NOTELIST"


...and it does indeed output "rowSwap(NOTES". So, what am I doing wrong? Can ≠ not be used with strings?


Since I know you'll probably ask me, here's the full source:

http://sc.cemetech.net/?xpi=dc3f42c3e7981c102f7cb9dd71761f03

EDIT: pastebin available here:

http://pastebin.com/fBcCvEA2

Thank you for your time.
Just for fun, in case you're getting a newline, try this:


Code:
:If sub(det(9,"NOTELIST")1,6)≠"rowSwap(NOTES
I was sure that was going to work, but I'm getting a DIM error - probably because the AppVar hasn't been created and sub( has nothing to substring.
techboy6601 wrote:
I was sure that was going to work, but I'm getting a DIM error - probably because the AppVar hasn't been created and sub( has nothing to substring.
OK, easy enough to fix:


Code:
det(9,"NOTELIST"
:If length(Ans)<6 or sub(Ans,1,6)≠"rowSwap(NOTES
:Then
:...does not exist...
Nope, still getting that error. I can confirm that it worked fine before, though, so it can't be my code.
techboy6601 wrote:
Nope, still getting that error. I can confirm that it worked fine before, though, so it can't be my code.
What, you're still getting the DIM error? What what worked fine before what?
EDIT: I am no longer getting the DIM error, but the original problem (the code running every time) still persists.

EDIT 2: After a RAM clear (and a new ROM), I am getting the DIM error again. Again, this worked fine before I added in your changes.

Code: http://pastebin.com/D5LtabjD
techboy6601 wrote:
EDIT: I am no longer getting the DIM error, but the original problem (the code running every time) still persists.

EDIT 2: After a RAM clear (and a new ROM), I am getting the DIM error again. Again, this worked fine before I added in your changes.

Code: http://pastebin.com/D5LtabjD
You didn't put the code I posted. You missed the first line.

KermMartian wrote:
techboy6601 wrote:
I was sure that was going to work, but I'm getting a DIM error - probably because the AppVar hasn't been created and sub( has nothing to substring.
OK, easy enough to fix:


Code:
det(9,"NOTELIST"
:If length(Ans)<6 or sub(Ans,1,6)≠"rowSwap(NOTES
:Then
:...does not exist...
I am still unfortunately getting the same DIM error. New code here:

http://pastebin.com/3uXqX42v
This has been moved to the TI-BASIC section.
merthsoft wrote:
This has been moved to the TI-BASIC section.
Thanks, shaun. Smile Techboy: I forget that TI-BASIC doesn't do short-circuiting. Sad


Code:
:DelVar SIf 6<=length(Ans
:(sub(Ans,1,6)="rowSwap(NOTES->S
:If not(S
:Then
:det(0,"rowSwap(NOTES",5
:det(6,"rowSwap(NOTES","NOTELIST",1
:End
Now, I'm getting a syntax error.


Code:

:DelVar S
:If 6<=length(Ans
:(sub(Ans,1,6)="rowSwap(NOTES->S
:If not(S
:Then
:det(0,"rowSwap(NOTES",5
:det(6,"rowSwap(NOTES","NOTELIST",1
:End


I of course fixed the mistake on the first line, but I couldn't really tell what you were trying to do on the second line so I left it alone. Care to explain?
It wasn't a mistake. Read the Optimization chapter of my book, and you'll see the fun things you can do with Delvar (including concatenating it with the following command). Don't forget to keep
Code:
det(9,"NOTELIST"
right before the Delvar command, or right after it. and make sure you change the -> to a STO symbol and the <= to the less-than-or-equal-to symbol.
Yes! Thank you! I feel so relieved now that I have that part done. Now to read your book (again!) to figure out what the heck you just did! Very Happy
I'm glad to help. Feel free to ask any follow-up questions if you're confused after carefully reading through my code.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement