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. 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. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
71B: DIM a variable, but keep the old value if it's already the right type? - Dave Britten - 03-23-2021, 01:08 AM
RE: 71B: DIM a variable, but keep the old value if it's already the right type? - Joe Horn - 03-23-2021, 03:05 AM
RE: 71B: DIM a variable, but keep the old value if it's already the right type? - Valentin Albillo - 03-23-2021, 03:06 AM
RE: 71B: DIM a variable, but keep the old value if it's already the right type? - J-F Garnier - 03-23-2021, 08:19 AM
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
RE: 71B: DIM a variable, but keep the old value if it's already the right type? - Valentin Albillo - 03-23-2021, 11:01 PM
|
User(s) browsing this thread: 1 Guest(s)