71B: DIM a variable, but keep the old value if it's already the right type?
|
03-23-2021, 03:05 AM
Post: #2
|
|||
|
|||
RE: 71B: DIM a variable, but keep the old value if it's already the right type?
(03-23-2021 01:08 AM)Dave Britten Wrote: ... 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. The "HP-71 Reference Manual" says the following about the DIM command: "If DIM specifies a simple numeric variable that already exists, the variable is reinitialized to zero. Other variables are redimensioned, but not reinitialized (unless the data type -- or, if a string variable, the maximum string length -- is changed). If DIM expands an array, it also initializes all newly created elements in the array." Therefore, just make sure that the desired array already exists and contains the desired data type. Then using DIM to redimension it will not clobber its existing contents (unless redimensioned smaller, obviously). <0|ΙΈ|0> -Joe- |
|||
« 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)