Post Reply 
71B: DIM a variable, but keep the old value if it's already the right type?
03-23-2021, 01:08 AM
Post: #1
71B: DIM a variable, but keep the old value if it's already the right type?
Suppose I've got a BASIC program that prompts for a few variables, and then runs some calculations on them. A hypothetical example would be a binomial distribution program. I'd like to have the program - by way of something like INPUT "X? ",STR$(X);X - provide the previous values so that I could tweak one or two of them, and keep the rest the same. Much like INPUT on the 42S. But I'd also like to make sure that the variables are the correct types, and haven't been left as arrays or some other inappropriate types by a different program. If I use DIM or REAL to make sure they are the correct type, this zeroes them out, even if they were already REAL variables to begin with.

How might the 71B experts approach something like this? I know I can write the input values to an SDATA file and retrieve them at the beginning of the program, and I've done this for programs where it makes sense to keep the values indefinitely between runs. But is there a simpler option for when I don't care if one of the variables gets clobbered by another program I've run in the meantime?
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


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



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