Liberty BASIC Community Forum
« Am I on the right track »

Welcome Guest. Please Login or Register.
Feb 22nd, 2018, 12:21pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Am I on the right track  (Read 373 times)
JayCee
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 5
xx Am I on the right track
« Thread started on: Aug 17th, 2014, 07:00am »

Hi,

I have just started with Liberty Basic out of interest as much as anything as I have used Richard Russell's BBC4W for many years and before that BBC Basic on Acorn machines.

I would just like to make sure that I am reading things correctly before I confuse myself too much.

Is it correct to think that [labels] are the same as DEFPROC was in BBC Basic and if so can you just tell me how the program knows when it has reached the end of that particular procedure as there doesn't sem to be an equivalent ENDPROC call. I am assuming that it knows where the end is when it reaches another [label]; if this is correct then I can continue knowing I am on the right road.

Many thanks for answering what is a pretty Basic (sic) question!
« Last Edit: Aug 17th, 2014, 07:02am by JayCee » User IP Logged

MKnarr
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 432
xx Re: Am I on the right track
« Reply #1 on: Aug 17th, 2014, 07:47am »

A [label] defines a section of code where you want to do something specific. For example when you have a button (or radio button, checkbox, list box etc) defined, the code might look like this:

Code:
button #main.b1, "Do Something", [buttonclick], UL, 440, 5, 100, 30 


When you click on the button, the program will go to the label [buttonclick]. That code will look something like:

Code:
[buttonclick]
do something
do something
wait
 


Note the 'wait' at the end. Without that 'wait' the program would fall through to the next bit of code and execute that code. The program then waits for the user to do something else. Select another button, checkbox etc. Although many people don't like to use them that section of code might also end with a 'goto' or even an 'end' but is does have to finish with something.

So in essence, the Wait should be equivalent to ENDPROC. Of course subroutines and gosubs end differently.

« Last Edit: Aug 17th, 2014, 07:51am by MKnarr » User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is online

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5665
xx Re: Am I on the right track
« Reply #2 on: Aug 17th, 2014, 1:25pm »

Quote:
Is it correct to think that [labels] are the same as DEFPROC


No I don't think so. Liberty BASIC has a function and a sub system for defining stand alone procedures.

The [Branch] system is more about replacing line numbers and GOTO processing. It wraps code into blocks, you can move from block to block by calling [Branch] and so you don't need all the inbetween line numbers.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls