Post Reply 
HP71B: lets come to speed
10-04-2021, 10:41 PM
Post: #5
RE: HP71B: lets come to speed
(10-04-2021 07:57 PM)floppy Wrote:  Question 1: all variables of the 3 functions will be "local" or "global"? Are all variables in BASIC local for the separate functions?

Functions, DEF FN : variables used within the function definition are global, except for the function parameters, ¡f any, which are local.

Subprograms, SUB: all variables defined or used within the subprogram are local; parameters can have their values passed by value (so they are local) or by reference (so they are global).

Quote:Question 2: several functions or several subroutines can be in 1 file or they should be separated one function or one subroutine in one file?

I think that by "subroutines" you actually mean "subprograms". Any number of function definitions and/or subprograms may be present in a single file or on multiple files. Functions can only be called from their own file, you can't call from one file a function which is defined in another file. On the contrary, subprograms can be called from their own file or from any other.

Quote:Question 3: how many calls of calls of calls.. can make a BASIC program in HP71B?

No limit, i.e., limited only by available memory. The calls may be recursive, i.e., the subprogram can call itself, also no limit on the recursion levels depth except available memory. Functions can also be recursive but you have to be very careful with the variables used inside, as they are global for all levels of recursion. Even non multi-line functions can be recursive (tricky).

Quote:Question 4: can make an HP71B BASIC program a call of itself? how many time?

I think you mean "subprogram" instead of "program". The answer is the same as the previous question, there's no limit on the number of recursive calls except available memory.

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP71B: lets come to speed - floppy - 10-04-2021, 03:47 PM
RE: HP71B: lets come to speed - floppy - 10-06-2021, 10:15 AM
RE: HP71B: lets come to speed - floppy - 10-04-2021, 07:57 PM
RE: HP71B: lets come to speed - Valentin Albillo - 10-04-2021 10:41 PM
RE: HP71B: lets come to speed - floppy - 10-08-2021, 10:43 AM



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