Post Reply 
71B: DIM a variable, but keep the old value if it's already the right type?
03-23-2021, 11:46 AM
Post: #5
RE: 71B: DIM a variable, but keep the old value if it's already the right type?
Cool, thanks guys. I should have mentioned that I'm aware DIMing an array/matrix won't clear its contents (unless you're shrinking its size or changing its type); it's more the scalar variables I'm worried about. DIM/REAL etc. will zero them out even if they're already the correct type. And it's just the variables that the program would be using as input prompts that I would like to retain, so that the values used during the previous run of the program can be presented as defaults on subsequent runs.

I hadn't dived into the Math ROM yet, so didn't know that TYPE() was available. As a matter of fact, I was looking through the 71B manuals last night trying to determine if there was something like that built in. Smile I've got the MultiMod at my disposal now, so I'll probably use the IF TYPE(X)<>... approach in cases where I'd like to reuse a value if it's still available, but the data isn't important enough to bother storing in a file.

Granted, if the number of input variables gets large enough - say, more than six or so - it's probably less code to just save/load everything in an SDATA file.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 71B: DIM a variable, but keep the old value if it's already the right type? - Dave Britten - 03-23-2021 11:46 AM



User(s) browsing this thread: 1 Guest(s)