local procedure GetMinNumberClassic(a: Integer; b: Integer): Integer
begin
if a < b then
exit(a)
else
exit(b);
end;
local procedure GetAgeInfoClassic(Age: Integer): Text
begin
if Age >= 18 then
exit('Adult')
else
exit('Minor');
end;
local procedure AbsIntegerClassic(InputInteger: Integer): Integer
begin
if InputInteger < 0 then
exit(-InputInteger)
else
exit(InputInteger);
end;
local procedure GetMinNumber(a: Integer; b: Integer): Integer
begin
exit(a < b ? a : b);
end;
local procedure GetAgeInfo(Age: Integer): Text
begin
exit(Age >= 18 ? 'Adult' : 'Minor');
end;
local procedure AbsInteger(InputInteger: Integer): Integer
begin
exit(InputInteger < 0 ? -InputInteger : InputInteger);
end;
local procedure TestInlineAssign(a: Integer; b: Integer; Age: Integer; InputInteger: Integer)
var
AgeInfo: Text;
MinNumber: Integer;
begin
MinNumber := a < b ? a : b;
AgeInfo := Age >= 18 ? 'Adult' : 'Minor';
AbsInteger := InputInteger < 0 ? -InputInteger : InputInteger
end;
local procedure TestInlineParams(a: Integer; b: Integer; Age: Integer; InputInteger: Integer)
begin
ProcessMinNumber(a < b ? a : b);
ProcessAgeInfo(Age >= 18 ? 'Adult' : 'Minor');
ProcessAbsInteger(InputInteger < 0 ? -InputInteger : InputInteger);
end;
local procedure ProcessAbsInteger(AbsInteger: Integer)
begin
//Do something with integer
end;
local procedure ProcessAgeInfo(AgeInfo: Text)
begin
//Do something with AgeInfo
end;
local procedure ProcessMinNumber(MinNumber: Integer)
begin
//Do something with MinNumber
end;
procedure GetDayName(Day: Integer): Text
var
DayName: Text;
begin
DayName := (Day = 1) ? 'Monday' :
(Day = 2) ? 'Tuesday' :
(Day = 3) ? 'Wednesday' :
(Day = 4) ? 'Thursday' :
(Day = 5) ? 'Friday' :
(Day = 6) ? 'Saturday' :
(Day = 7) ? 'Sunday' :
'Invalid Day';
exit(DayName);
end;
procedure GetDayName(Day: Integer): Text
begin
case Day of
1:
exit('Monday');
2:
exit('Tuesday');
3:
exit('Wednesday');
4:
exit('Thursday');
5:
exit('Friday');
6:
exit('Saturday');
7:
exit('Sunday');
else
exit('Invalid Day');
end;
end;
procedure CalculateBonus(Salary: Decimal; YearsWorked: Integer; PerformanceRating: Integer): Decimal
var
Bonus: Decimal;
begin
Bonus := (YearsWorked > 10 and PerformanceRating > 8) ? Salary * 0.2 :
(YearsWorked > 5 and PerformanceRating > 6) ? Salary * 0.1 :
(YearsWorked > 3 and PerformanceRating > 4) ? Salary * 0.05 :
0;
exit(Bonus);
end;
procedure CalculateBonus(Salary: Decimal; YearsWorked: Integer; PerformanceRating: Integer): Decimal
var
Bonus: Decimal;
begin
case true of
(YearsWorked > 10) and (PerformanceRating > 8):
Bonus := Salary * 0.2;
(YearsWorked > 5) and (PerformanceRating > 6):
Bonus := Salary * 0.1;
(YearsWorked > 3) and (PerformanceRating > 4):
Bonus := Salary * 0.05;
else
Bonus := 0;
end;
exit(Bonus);
end;
procedure IsEligibleForPromotion(YearsWorked: Integer; PerformanceRating: Integer): Boolean
var
Eligible: Boolean;
begin
Eligible := (YearsWorked > 5) and (PerformanceRating > 7) ? true : false;
exit(Eligible);
end;
procedure IsEligibleForPromotion(YearsWorked: Integer; PerformanceRating: Integer): Boolean
var
Eligible: Boolean;
begin
Eligible := (YearsWorked > 5) and (PerformanceRating > 7);
exit(Eligible);
end;
procedure CalculateShippingCost(OrderAmount: Decimal; Destination: Text[30]; IsExpress: Boolean): Decimal
var
ShippingCost: Decimal;
begin
ShippingCost := (Destination = 'US') ? (IsExpress ? (OrderAmount > 100 ? 10 : 15) : (OrderAmount > 100 ? 5 : 10)) :
(Destination = 'EU') ? (IsExpress ? (OrderAmount > 100 ? 20 : 25) : (OrderAmount > 100 ? 15 : 20)) :
(Destination = 'APAC') ? (IsExpress ? (OrderAmount > 100 ? 30 : 35) : (OrderAmount > 100 ? 25 : 30)) :
50;
exit(ShippingCost);
end;