Day 026: ERASE - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Official Links (https://staging.qb64phoenix.com/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://staging.qb64phoenix.com/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://staging.qb64phoenix.com/forumdisplay.php?fid=49) +---- Thread: Day 026: ERASE (/showthread.php?tid=1243) Pages:
1
2
|
RE: Day 026: ERASE - TerryRitchie - 06-10-2023 (06-10-2023, 06:28 PM)sivacc Wrote: Hi , I 'm new here . But have persisting problem ..I want to dim an array, or redim it in a sub and pass values through sub's parameter list . I get the dim bounds reading a file ( in the sub) It wont compile. When I print the ubound before redim , I get 10, default size in BASIC it seems. Breaking the sub, declaring arrays in the main is so awkward. Loads of thanks for a tip or clue ?Do you have an example of what you are trying to do? RE: Day 026: ERASE - SMcNeill - 06-10-2023 (06-10-2023, 06:28 PM)sivacc Wrote: Hi , I 'm new here . But have persisting problem ..I want to dim an array, or redim it in a sub and pass values through sub's parameter list . I get the dim bounds reading a file ( in the sub) It wont compile. When I print the ubound before redim , I get 10, default size in BASIC it seems. Breaking the sub, declaring arrays in the main is so awkward. Loads of thanks for a tip or clue ? You'll want to REDIM the array in the main module, and then resize it as needed in the SUB/FUNCTION. A quick example is below for you: Code: (Select All)
RE: Day 026: ERASE - bplus - 06-10-2023 Sounds like you are trying to use an array dimed in main code in a private sub then you have to say Dim Shared so subs can see it too or pass it in parameters list when calling subroutine. 10 is the allowed maximum for an array not Dimensioned. Also Erase works for static Dim arrays not for Dynamic ReDim arrays. That wacked me out when I first started with QB64, why won't a Dim array ReDim? (because it is static because I used Dim I'm stuck with one size) or how do your clear a Dim array? (ERASE !!!) |