Author | Topic: Do while problem? | |
---|---|---|
Carlos A Beling | Do while problem? on Fri, 19 Mar 2021 15:46:01 -0300 Hi. Good afternoon. It seems that it has an error in the the control structure "do while". Please compile the attached program for to see that the expression used in the statement "if" is given as correct and gives an error in the statement "do while". Do someone knows why? Fraternally Beling Test.prg | |
Andreas Gehrs-Pahl | Re: Do while problem? on Fri, 19 Mar 2021 17:16:28 -0400 Carlos, >It seems that it has an error in the the control structure "do while". The problem lies with the pre-processor, not the compiler. All "do while" statements are converted by the pre-processor to a simple "while" statement. The compiler complains, because the pre-processor doesn't remove the "do " in front of the while in your code. I assume that the reason for this is that you are calling a method of an object of self in your function -- which you should of course only do in a method -- and that the many ":" colons are confusing the pre-processor. Simply remove the superfluous "do " in front of the while -- I always use simply "while" and never "do while" -- and everything will compile just fine. Alternatively, you could try to change the Xbase++ "Std.ch" file -- or add your own pre-processor directives -- to handle your specific code construct. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [L]: https://www.LinkedIn.com/in/AndreasGehrsPahl [F]: https://www.FaceBook.com/AbsoluteSoftwareLLC | |
Carlos A Beling | Re: Do while problem? on Sat, 20 Mar 2021 16:49:35 -0300 Hello Andreas. good afternoon. Many thanks again. I do call it in a method. I used function in the example for to avoid compiler error message. Fraternally Beling On 19/03/2021 18:16, Andreas Gehrs-Pahl wrote: > Carlos, > >> It seems that it has an error in the the control structure "do while". > > The problem lies with the pre-processor, not the compiler. All "do while" > statements are converted by the pre-processor to a simple "while" statement. > > The compiler complains, because the pre-processor doesn't remove the "do " > in front of the while in your code. I assume that the reason for this is > that you are calling a method of an object of self in your function -- which > you should of course only do in a method -- and that the many ":" colons are > confusing the pre-processor. > > Simply remove the superfluous "do " in front of the while -- I always use > simply "while" and never "do while" -- and everything will compile just > fine. > > Alternatively, you could try to change the Xbase++ "Std.ch" file -- or add > your own pre-processor directives -- to handle your specific code construct. > > Hope that helps, > > Andreas > |