[fpc-pascal] If vs case or something else?

James Richters james at productionautomation.net
Fri Jul 7 17:47:03 CEST 2017

Thank you Sven and Stefan for the advice and examples, I really appreciate it.  I'll to some time tests with some sample programs and figure out which way to go with it.  It seems at first glance that the array of procedures would be more complicated, but the more I think about it, the more I think it would actually be easier to manage and easier to follow than the insane list of if, then, else statements, and also easier to manage than a huge long case statement, I do have several other conditional statements within the big long if then else structure and sometime I mess up the entire thing by misplacing an end, or leaving one out...  this would never be a problem with the array of procedures as the conditional statements inside the procedures would be well defined as they would not be mixed in with a huge list of if statements, and I might be able to combine many of the procedures and just pass them related arguments.  It might also help organization with Units.  Also thanks to Ched for the idea using a case statement on just the first character in a string then smaller case statements within that.  I do have another situation where I needed to use string input and figure out what to do based on the string value and it seems this would save a lot of time.


More information about the fpc-pascal mailing list