I'm having trouble passing a string to a Function in order to edit it. The code which works fine outside of a Function just won't modify the string inside the Function for some reason. Any idea what I'm doing wrong?
Code:
DIM a$ AS String
FUNCTION editStringFN(stringToEdit$ AS String, position AS Integer, newLetter$ AS String) AS String
stringToEdit$(position)=newLetter$
RETURN stringToEdit$
END FUNCTION
CLS
a$="sample"
PRINT a$; "- original string"
'try to edit string via the function
a$=editStringFN(a$, 1, "i")
PRINT a$; "- function fails to edit"
'same edit without using the function
a$(1)="i"
PRINT a$; "- works as regular code"