Author Topic: REDIM issue. Is this by design?  (Read 808 times)

0 Members and 2 Guests are viewing this topic.

Brian Alvarez

  • Guest
REDIM issue. Is this by design?
« on: May 18, 2019, 12:28:20 PM »
The Following code outputs:

Code: [Select]
NEW CONTENTS FOR ONE
ORIGINAL CONTENTS

Code: [Select]
DIM STRING TST(1)

TST(1) = "ORIGINAL CONTENTS"

FUNCTION i_use_TST() AS LONG

print TST(1) chr(13, 10)

END FUNCTION

REDIM STRING TST(1)
TST(1) = "NEW CONTENTS FOR ONE"

' Print this to screen, to make sure the contents of
' TST(1) have been updated.
print TST(1) chr(13, 10)

' Now that the contents of TST(1) have been proved to
' have been updated, call i_use_TST().
i_use_TST()

Is this by design? How does it work?


Charles Pegge

  • Guest
Re: REDIM issue. Is this by design?
« Reply #1 on: May 18, 2019, 03:30:42 PM »
Hi Brian,

Make the first one REDIM instead of DIM.

DIM is static only.

Brian Alvarez

  • Guest
Re: REDIM issue. Is this by design?
« Reply #2 on: May 18, 2019, 03:57:38 PM »
Got it. Thanks Charles. :)