Hairy Pixels via fpc-pascal said on Fri, 16 Jun 2023 09:57:36 +0700 >> On Jun 16, 2023, at 6:07 AM, Steve Litt via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> Is http://sprunge.us/MOJIg4 a legitimate use of a for loop with >> break? I know there are better ways to do it, but I'm just wondering >> whether it's legitimate. > >What are you trying to do exactly?
Explore FPC. > It's an array with a terminator >string? Probably the length of the array should be set instead of >doing string compares every loop. I need to set it in the var declaration, right? > >program fordo; >var words: array[1..6] of string; >var ss: integer; > >begin >for ss := 1 to 6 do > words[ss] := '~'; ^^^^^^^^^^^^^^^^^^^^ Is it legitimate to set elements inside a for loop? > >words[1] := 'One'; >words[2] := 'Two'; >words[3] := 'Three'; > >for ss := 1 to 6 do > if words[ss] = '~' then > break ^^^^^ IS IT legitimate to use a break (or continue) inside a for loop? Thanks, SteveT Steve Litt Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal