Skip to content

Instantly share code, notes, and snippets.

@MarkGoldberg
Created November 5, 2020 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkGoldberg/67850c17f8656126b0e3fe29babd4de5 to your computer and use it in GitHub Desktop.
Save MarkGoldberg/67850c17f8656126b0e3fe29babd4de5 to your computer and use it in GitHub Desktop.
How to reset an ANY so it can take on a new data type
PROGRAM
MAP
END
INCLUDE('debuger.inc'),ONCE
dbg debuger
SomeGroup GROUP
LongVar LONG
RealVar REAL
END
CurrentField ANY
CODE
dbg.MG_Init('TestClearAny')
SomeGroup.LongVar = 42
SomeGroup.RealVar = 56.789
CurrentField &= WHAT(SomeGroup, 1)
dbg.ODS('1: CurrentField['& CurrentField &']') ! expecting 42
! got 42
CurrentField = 'Hello There'
dbg.ODS('2: CurrentField['& CurrentField &']') ! expecting 0
! got 0
CLEAR(CurrentField) ! FAILS to reset the ANY so it can take on a new data type
CurrentField = 'Round #2'
dbg.ODS('3: CurrentField['& CurrentField &']') ! hoping for 'Round #2'
! got 0
CurrentField &= NULL ! SUCCEEDS resetting the ANY so it can take on a new data type
CurrentField = 'Yet another try'
dbg.ODS('4: CurrentField['& CurrentField &']') ! hoping for 'Yet another try'
! got 'Yet another try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment