Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Reader's Letters - Jim Owen===== ^Published By^Date^Version^Knowledge Level^Keywords^ |Sprezzatura Ltd|01 NOV 1990|2.021+|EXPERT|INT(), SPACE, FUNCTION| "I've discovered something that might be of interest to some AREV programmers regarding the calling of homemade functions. I had a function called SPC which padded blank spaces onto a variable. For example X = 65 Y = SPC(X,5,"R") would return Y = ' 65'. (Unsure as to why this differs from Y = 65 "R#5" - Ed). However I discovered that this function also changed X! I wanted my function to work like INT() which does not change the value of the variable inside the parens, only the value to the left of the '='. RTI told me that the C-esque use of local vs global variables doesn't apply to RBASIC. One way to solve it was to make parameter 1 a literal string. This was done by calling the function thus X = 65 Y = SPC(X:" ",5,"R") Concatenating a null to the variable changes it to a string and does NOT change X. Another way around the problem was to immediately stuff some other variable with X on entering the function then operating on, and returning, this new variable. Incidentally the INT() function is in assembler and avoids the problem altogether". (Volume 2, Issue 6, Page 3) tips/revmedia/v2i6a1.txt Last modified: 2024/06/19 20:20by 127.0.0.1