English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 13 January 2024, 18:15   #1
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Something like 'DECLARE SUB' for Statements (Forward declarartions)

In a piece of code I have some Statements (Functions).

They all must be declared and implemented before using them, e.g.

Code:
Statement multiplicateMatrix{sx, sy, i}
  Shared Points()
  Points(i)\x = sx * Points(i)\x
  Points(i)\y = sy * Points(i)\y
End Statement


For i=0 To points_count
  multiplicateMatrix{sx, sy, i}
Next i
In AmigaBASIC there was a way to forward declare functions and put their implementations at the end of the code file:

Code:
DECLARE SUB multiplicateMatrix(sx, sy)

...

For i=0 To points_count
  Call multiplicateMatrix(sx, sy, i)
Next i

...

SUB s.transform(sx, sy, i)
  SHARED x.points, y.points
  x.points(i) = sx*x.points(i)
  y.points(i) = sy*y.points(i)
End SUB
Is there something similar in BlitzBasic which would allow to put the implementation of all functions (Statements and Procedures) to the end of a file?
thyslo is offline  
Old 13 January 2024, 21:04   #2
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,348
Nope, there's no way to do that. Usually what I do is store the functions and statements in a separate file and include that at the top of my main source file. That keeps them from filling up most of the listing.
Daedalus is offline  
Old 13 January 2024, 22:33   #3
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 189
Thank you, and especially for the hint with the extra file for the functions. I'll probably do the same:-)
thyslo 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
Forward statement or function Nightshft Coders. Blitz Basic 5 17 April 2020 01:02
Looking forward to the Vampire 4? Welshieinnz Amiga scene 406 31 January 2020 09:13
If statements with Vasm LaBodilsen Coders. Asm / Hardware 5 24 September 2019 17:55
ASM in statements - accessing "shared" variables earok Coders. Blitz Basic 4 27 September 2017 06:52
Blitz2 blit and block statements inside procedures htdreams Coders. Tutorials 4 29 April 2013 08:36

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 15:01.

Top

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