Project

General

Profile

Bug #348

A user defined function cannot call another user-defined function. (Causes internal error or program freeze.)

Added by Brian Flanagan about 4 years ago. Updated about 3 years ago.

Status:
Feedback
Priority:
High
Target version:
Start date:
04/18/2020
Due date:
% Done:

0%

Estimated time:
2:00 h
Affected version:

Description

Example:

/*
    Leap Year:  Brian Flanagan
    Parameter:  y   4-digit year
    Returns:    Leap Year (1=leap, 0=not) ' Yes, there's a reason for 0 or 1
*/
Function "LeapYear",y
    ly=0
    If y=4*Int(y/4) Then ly=1
    If y=100*Int(y/100) Then ly=0
    If y=400*Int(y/400) THen ly=1
End Function(ly)

/*
    Parameters: y   4-digit year
                m   month (1-12)
                d   day of month (1-31)
    Returns:    Day of year.
*/
Function "DayOfYear", y, m, d
    doy=Int(3055*(m+2)/100)-91
    If m>2 Then doy=doy-2+LeapYear(y)
    doy=doy+d
End Function(doy)

Print DayOfYear(2020,1,31),DayOfYear(2020,4,18)

Result in this instance is an Internal Error.

Also available in: Atom PDF