The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Optional Parameter in User Function.
06-14-2021, 09:03 PM (This post was last modified: 06-14-2021 09:10 PM by matalog.)
Post: #1
Optional Parameter in User Function.
Is there anyway to set an optional paramater in a User created function?

I use the following all day, to convert feet to inches:

Code:
EXPORT F2M(A,B)
BEGIN
 C:=A/3.28084;
 D:=B/39.3701;
 E:=C+D;
 RETURN ROUND(E,2);
END;

I press a user defined key that types into F2M() for me, and leaves the cursor in the brackets, which is very convenient.

Quite often, I do not need to input any inches, and therefore would like to be able to set B as an optional parameter/variable in the function, where the function will default B to Zero when it is not input. The function will currently not run if I do not enter a value for A, and a value for B. F2M(6,2) is an accepted input, but F2M(10) will not work, and I would like it to, instead of having to type F2M(10,0).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Optional Parameter in User Function. - matalog - 06-14-2021 09:03 PM



User(s) browsing this thread: 2 Guest(s)