English Amiga Board Def Fn help please?
 Register Amiga FAQ Rules & Help Members List  /  Moderators List Today's Posts Mark Forums Read

 18 November 2015, 01:16 #1 volvo_0ne Registered User   Join Date: Mar 2015 Location: Sheffield UK Posts: 360 Def Fn help please? Code: ```Rem function strips leader from numbers Def Fn N\$=Right\$(Str\$(I),Len(Str\$(I))-1) For I=1 To 100: Rem 100 iterations Print "test"; Fn N\$ : Rem do it! Next I : Rem: it works!!!! Rem but only with variable i :-( End``` The above code strips leading spaces/+/- from numbers, and it works. but for the life of me, I cannot remember how to pass the function a number other than the variable "i", so it can be used with any number . I'm quite certain the solution is simple (as I am in my old age) . Can anyone help please? Maybe I'm getting confused somewhere along the line, but I thought only the variable declerations mattered EG: Def Fn N\$=Right\$(Str\$(anything),Len(Str\$(anything))-1) then call with fn (anythingelse,anythingelse) or was that some other language? Last edited by volvo_0ne; 18 November 2015 at 01:23.
 18 November 2015, 01:56 #2 Leffmann   Join Date: Jul 2008 Location: Sweden Posts: 2,265 `Def Fn NUM\$(I)=Str\$(I)-" "-"-"` and `N\$=Fn NUM\$(i)`.
19 November 2015, 19:54   #3
volvo_0ne
Registered User

Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
Quote:
 Originally Posted by Leffmann `Def Fn NUM\$(I)=Str\$(I)-" "-"-"` and `N\$=Fn NUM\$(i)`.
Thanks for that, it works a treat except when trying to read the Fn inside a procedure, but I'll look into that.

Cheers

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)