On 10/16/23 16:24, Todd Zuercher wrote:
Gene,

This is how I understand it to work.  (It's been a while since I did a lot of 
subroutine programming so hopefully I don't mislead you.)

1. Yes, subs. do have access to global variables. The also have access to 
ordinary variables grater than #30 from the calling program.
The docs don't elaborate, thanks
2. Yes, subs. can write to global variables
I thought so, thanks

3. When one sub calls another sub it is usually called nesting. Yes, nested 
subs are supported (up to 10 deep.)
The docs don't claim that in their sparcity. Thanks again Todd

Only parameter numbers #1-#30 are considered local variables and are not 
automatically passed from the calling program to the subroutines.

That limitation has had me using global variables for about 20 years now in the code I've written. Someplace, DNK where now, I read that such passed as [1],[2] etc up to 30 are local to the sub and unchanged in the calling proggy regardless of what the sub does to them.

Thanks Todd.  Take care & stay well.

Todd Zuercher
P. Graham Dunn Inc.
630 Henry Street
Dalton, Ohio 44618
Phone:  (330)828-2105ext. 2031

-----Original Message-----
From: gene heskett <ghesk...@shentel.net>
Sent: Monday, October 16, 2023 3:22 PM
To: Enhanced Machine Controller (EMC) <emc-users@lists.sourceforge.net>
Subject: [Emc-users] stupid question

[EXTERNAL EMAIL] Be sure links are safe.

I need to make some subroutines into callable files, but some sub call other 
subs.  So 3 Q?'s:

1; do sub files need all the data passed in [] or do they have access to 
globally defined vars? in the main calling program?

2; can a subroutine file write to a globally defined #<_variable_name> to 
update it?

3; can a subroutine file call another file, then use the results of that call?

Thanks all.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
   soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
   - Louis D. Brandeis


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users
.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to