Variable length strings and arrays

While looking through the help for some information on maximum string sizes, I came across this little nugget: you can declare variable length strings and arrays. As in, you pass a number (a dimension) into a procedure, and you can use that dimension in a data declaration. 

You can also do this dynamically with New() of course, but this is a much simpler and cleaner approach. 

Here's the Help example:

                                            PROGRAM

                                            MAP
                                                TestProc(LONG)
                                            END

    CODE
    TestProc(200) !can also be an initialized variable

TestProc                                    PROCEDURE(LONG VarLength)
VarString                                       STRING(VarLength)
    CODE
    VarString = 'String of up to 200 characters'


The Help also shows how to handle variable length arrays. 

There are restrictions - the variable can only be local to a procedure or routine, and cannot be in a class, group etc. 

See the topic Variable Size Declarations for more information. 

Rick Martin and Mike Hanson tell me that this syntax will also work. 

TestProc                                    PROCEDURE(string s)
VarString                                       STRING(len(s))