The error is illegal assignment to a loop variable on the line with the else. In other words it seems to think the second loop is the else condition for the if statement inside the loop.. Definitely wrong
does anyone have any idea of how to do this?
This is not Python, the "else" is always connected to the last "if" before it. See Mark's post, it should make it very clear for you.
Putting begin-end where appropriate certainly solves this.
Add a Y var for main loop, assign x value according to direction, and check in loop to inc or dec xThat was a nudge in the good direction but did you know that there exist delta airlines and they use planes that can fly in different directions and make use of planes that can have other ranges ? While that is good to know that you could also choose for another airline ?
HiOr this
Another possibility would be to utilize 'case', like this:I hope you get the gist of the algorithm, 'cause I really don't wanna mess with your caps-locked-code...
var x: integer; begin case IsFirst of false: begin for x:= ControlCount-1 downto 0 do if Controls[x].Name = 'Memo1' then exit(Controls[x]); end; true: begin for x:= 0 to ControlCount-1 do if Controls[x].Name = 'Edit1' then exit(Controls[x]); end end; Result:= nil; fPresenter.Provider.NotifySubscribers(prStatus,nil,Str2Pch('(!) Attention: Control was not found! ')); end;
Regards Benny