English Amiga Board


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

 
 
Thread Tools
Old 10 December 2020, 18:59   #1
AF2013
Registered User
 
Join Date: Apr 2013
Location: .
Posts: 267
Question Function Vs Statement?

Which is better as are both the same?

I did the function and run the program but it is crash the system! So frustrating
AF2013 is offline  
Old 10 December 2020, 19:56   #2
phipslk
Registered User
 
Join Date: Nov 2018
Location: Frankfurt, Germany
Posts: 5
Could you show the code?

Gesendet von meinem Mi Note 10 Lite mit Tapatalk
phipslk is offline  
Old 10 December 2020, 19:58   #3
E-Penguin
Banana
 
E-Penguin's Avatar
 
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
Quote:
Originally Posted by AF2013 View Post
Which is better as are both the same?
Functions return a value, statements don't.
E-Penguin is offline  
Old 10 December 2020, 23:00   #4
AF2013
Registered User
 
Join Date: Apr 2013
Location: .
Posts: 267
Question

Quote:
Originally Posted by E-Penguin View Post
Functions return a value, statements don't.
Ahhh Right, When I used Statement to show Circle or Square on the screen by using Statement(once I understand on how work then I will be using it more!)

Code:
Screen 0,0,0,320,200,3,0,"Welcome Blitz 2",1,2,0

Statement Draw_Everythings{}
                Bitmap 0,320,200,3
                Circlef 160,100,50,3 
                mousewait
End Statement

Draw_Everythings{}
End
I dont understand why doesnt work
AF2013 is offline  
Old 11 December 2020, 10:25   #5
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
The Statement/Function thing doesn't look like it's the issue in your code. What error are you getting in the debugger? It looks like you're trying to open a screen with a bitmap that doesn't exist yet. Try moving the Bitmap command out of the statement and before the screen command.
Daedalus is offline  
Old 11 December 2020, 18:55   #6
AF2013
Registered User
 
Join Date: Apr 2013
Location: .
Posts: 267
Question

Quote:
Originally Posted by Daedalus View Post
The Statement/Function thing doesn't look like it's the issue in your code. What error are you getting in the debugger? It looks like you're trying to open a screen with a bitmap that doesn't exist yet. Try moving the Bitmap command out of the statement and before the screen command.
No Errors and it was showing Welcome Blitz 2 words few seconds then it crash the system as The code I did blow was this

Code:
Bitmap 0,320,200,3
Screen 0,0,0,320,200,3,0,"Welcome Blitz 2",1,2,0

Statement Draw_Everythings{}
                
                Circlef 160,100,50,3 
                mousewait

End Statement

Draw_Everythings{}
End
I was hoping that if I can get Statement working then I will be used While and wend loop to create game of moving things hopefully......somethings like this

Code:
Open Screen

While Press Escape
      Move_Ball{}
      Move_Bat{}
      Print_Score{}   
wend
End
AF2013 is offline  
Old 11 December 2020, 23:42   #7
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
I've just tested this, and the first code does give errors with the debugger running ("Uninitialised Bitmap"). You should always run the debugger while you're testing new code, because it'll catch many issues like that and give you hints about the issue instead of letting the system crash.

Moving the Bitmap command to the top lets it work just fine, and the program structure looks good to me
Daedalus 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
[blitz] re-dim arrays inside statement/function peceha Coders. Blitz Basic 7 24 June 2020 13:10
Forward statement or function Nightshft Coders. Blitz Basic 5 17 April 2020 01:02
for..each statement in CLI pieter1976 support.Other 10 09 January 2020 22:15
Share NewType to Statement/Function earok Coders. Blitz Basic 21 30 May 2018 13:37
Hyperion Statement on litigation with Amiga Inc. Ultron News 2 02 May 2007 11:06

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 02:48.

Top

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