English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 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.
volvo_0ne is offline  
Old 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)
.
Leffmann is offline  
Old 19 November 2015, 19:54   #3
volvo_0ne
Registered User

 
Join Date: Mar 2015
Location: Sheffield UK
Posts: 360
Quote:
Originally Posted by Leffmann View Post
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
volvo_0ne is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Def Jam Compilation Silmas request.Other 6 26 May 2009 00:04

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:16.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.05633 seconds with 15 queries