Hello,
I had to investigate a problem (code written by some else).
The following code does not what it should do, because the programmer did some mistakes.
if _TestrunDate1 > _TestrunDate2 then
if not CheckTestDataOk (_SerialNo1, 'Plausibilität', _TestrunState1, _TestrunDate1, _ItemToCheck, 1) then _Status:= false
else
if not CheckTestDataOk (_SerialNo2, 'Plausibilität', _TestrunState2, _TestrunDate2, _ItemToCheck, 1) then _Status:= false;
Yes, it's uggly code and hardly readable. If _TestrunDate1 is bigger than _TestrunDate2, then CheckTestDataOk will be executed twice, which was not the intention of the programmer.
So the problem must be fixed by improving the code.
But the difference between Delphi and TMS-Scripter I found out, is about how this behaves when adding a semicolon after the first occurence of "_Status:=false".
if _TestrunDate1 > _TestrunDate2 then
if not CheckTestDataOk (_SerialNo1, 'Plausibilität', _TestrunState1, _TestrunDate1, _ItemToCheck, 1) then _Status:= false**;**
else
if not CheckTestDataOk (_SerialNo2, 'Plausibilität', _TestrunState2, _TestrunDate2, _ItemToCheck, 1) then _Status:= false;
The above code (added semicolon) is still executable in TMS-Scripter, but not compilable anymore within Delphi IDE ( which is better behavoir).
Btw. I would like to upload the example-script, but it is not possible because it's not allowed. File-extensions (.psc,.sfm,.ssproj) are not allowed on your upload.
Regards,
Sam