J
Jake Geers
Guest
I have a function GetQuantity that returns a decimal. In some cases I want to return nothing i.e. and empty string so that ' ' is displayed.
Actual Behavior:
Desired Behavior:
In case 3 I can obviously return -1.0 or something but that is not what I need.
FUNCTION GetQuantity RETURNS DECIMAL(INPUT num AS INTEGER):
DEFINE VARIABLE quantity AS DECIMAL NO-UNDO FORMAT "->,>>>,>>9.9<<<<<<<<".
quantity = 3.3. //initialization is neccessary as IRL my value is initialized
IF num = 1 THEN DO:
RETURN 1.0.
END.
ELSE IF num = 2 THEN DO:
RETURN 2.0.
END.
RETURN quantity. //base case return ' '
END.
DISPLAY GetQuantity(3)
Continue reading...
Actual Behavior:
- GetQuantity(1) -> 1.0
- GetQuantity(2) -> 2.0
- GetQuantity(3) -> 3.3
Desired Behavior:
- GetQuantity(1) -> 1.0
- GetQuantity(2) -> 2.0
- GetQuantity(3) -> ' '
In case 3 I can obviously return -1.0 or something but that is not what I need.
FUNCTION GetQuantity RETURNS DECIMAL(INPUT num AS INTEGER):
DEFINE VARIABLE quantity AS DECIMAL NO-UNDO FORMAT "->,>>>,>>9.9<<<<<<<<".
quantity = 3.3. //initialization is neccessary as IRL my value is initialized
IF num = 1 THEN DO:
RETURN 1.0.
END.
ELSE IF num = 2 THEN DO:
RETURN 2.0.
END.
RETURN quantity. //base case return ' '
END.
DISPLAY GetQuantity(3)
Continue reading...