Let us consider calculating profit as example
Profit := Income-Expenditure;
There is no guarantee that Income and Expenditure data will always have a numeric data type. Some users may prefer to use ‘No Income’ or ‘No Expenditure’ values
The best way to avoid problems with data quality is to follow the pattern below.
Var vIncome: Float; vExpenditure: Float; begin // Converting strings to Floats Try vIncome:=Income; except vIncome:=0; end; try vExpenditure:=Expenditure; except vExpenditure:=0; end; // Calculation Result := vIncome-vExpenditure; end;