DECLARE CHANGE (A:STRING)
DEF PATH:STRING
SUB CHANGE (PATH)
''DO SOMETHING '
ENDSUB
RETURN
 
NEED A LITTLE HELP ON DECLARING AND PASSING A STING INTO A SUB, DOING SOMETHING TO IT AND THEN RETURNING THE CHANGED STRING BACK.
If any body has a second thanks
Texas Pete
			
			
			
				compile as a "console" exe
DECLARE CHANGE (A:STRING)
DEF PATH:STRING
path =" This is what I start with "
print path
change(path)
print path
print
	print "Press any key to close" 
	do:until inkey$<>""
	end
SUB CHANGE (A:string)
	a= a+" and I added this inside the sub"
	RETURN
ENDSUB
Larry
			
			
			
				Would this also work?  Based on how EBasic works, this should work.
def a:string
a = "Testing
print a
change()
print a
print "Press any key to END"
do:until inkey$<>""
end
sub change()
a = a+"more text"
return
endsub
			
			
			
				Bill,
Your example will most defintely work.
However, I have found that, for me, my example would be the safer to use in large programs.
In those cases you can easily use a variable in a sub for something like a loop counter and find out it is a global variable used also in another sub and have them interfere with each other.
For that reason I always "AUTODEFINE "OFF" and pass variables to subs and define local variables inside a sub.
I run into less problems that way.
Another variation of our 2 examples that would preserve the original in case you need something like an "Are you sure? " test:
def a:string
declare change(in:string),string
a = "Testing "
print a,change(a)
print "Press any key to END"
do:until inkey$<>""
end
sub change(z:string)
z="more text"
return z
endsub
Larry