- Nov
- 76
- 1
Hi all.
Not sure whether this has already been suggested (sorry if it was).
So.
There's IFF-ENDIFF, DO-ENDDO, SWITCH-ENDSWITCH, etc.
Why not have the same with FUNCTION ?
This would be a great feature because defining everything on a single line is often like writing embedded IF()'s in Excel.
Example:
I'm not eve sure if above code would work on a single-line definition...
just my 2¢
Not sure whether this has already been suggested (sorry if it was).
So.
There's IFF-ENDIFF, DO-ENDDO, SWITCH-ENDSWITCH, etc.
Why not have the same with FUNCTION ?
This would be a great feature because defining everything on a single line is often like writing embedded IF()'s in Excel.
Example:
FUNCTION LeapYear[%1]
REM Implicit sub-SETLOCAL within function definition
SET cent=%@INT[%1/100]
SET yr=%@EVAL[%1-%cent*100]
IFF %yr EQ 0 THEN
SET res=%@IF[%cent MOD 4 EQ 0,1,0]
ELSE
SET res=%@IF[%1 MOD 4 EQ 0,1,0]
ENDIFF
REM Function result would be mandatory, obviously!
SET LeapYear=%res
ENDFUNCTION
I'm not eve sure if above code would work on a single-line definition...
just my 2¢