Multiple Function Returns?

Blitz3D Forums/Blitz3D Beginners Area/Multiple Function Returns?

I was trying to devise a Function that would splice a string that contained Comma-Separated values.

the problem being that the Return function only returns one variable, when I really need at least two.

Here's my prog so far.

Type items
Field it_name$
Field it_ref
Field it_component_ref
End Type

Type components
Field comp_ref
Field comp_b_ref
Field comp_c_ref
Field comp_item_ref
End Type

file=OpenFile("it_dat.txt")

	
Repeat



	create_items.items=New items
	temp_name$=ReadLine$(file)

	result$=Store_And_Remove$(temp_name$)
	create_items\it_name$=result$

Until Eof(file)


For list_items.items = Each items
	temp_ref=list_items\it_component_ref
	temp_name$=list_items\it_name$
		Print temp_ref+" : "+temp_name$
Next














Function Store_And_Remove$(main$)

comma=Instr(main$,Chr$(44),1)    ;find end of name
RV$=Left$(main$,(comma-1)) ;store name
main$=Right$(main$,((Len(main$)-(comma)))) ; remove name from dataline
WHAT_TO_DO_WITH_THIS$=main$;store remaining text

Return RV$

End Function





I need to return the value of
WHAT_TO_DO_WITH_THIS$ as well as RV$

Anyone got any tips?

This might help... I know it doesn't answer your question, but it might solve your problem.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1204

Heh Thatnks, Rob - a link to kust the Mid command in the manual would've done! This command is a godsend and actually, that example shows everything I require! Thanks.

I'm just getting used to using Functions to make my coding neater and more optimised. My only prior experience of programming was with Spectrums and the FN command on that was lmiited just to mathematic routines, so it's quite a step, but, like Types, once you get the hang of them, they're invaluable!