BBC BASIC for Windows
« Tutorial for BBC BASIC »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:53pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Tutorial for BBC BASIC  (Read 1660 times)
Wendell
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Tutorial for BBC BASIC
« Thread started on: Mar 20th, 2014, 8:55pm »

I am using tutorial for help ..great help sometime. i am confuse when it come to the IF ,THEN, GOTO,GOSUB how to use labels.
Has al of the above been put on PROCs Also FN. IS THERE a specifiv place to look in tutorial for thishuh I CANNOT GET THE "IF THEN STATeMENT TO WORK ALL THE TIME.
User IP Logged

rtr
Guest
xx Re: Tutorial for BBC BASIC
« Reply #1 on: Mar 20th, 2014, 10:34pm »

on Mar 20th, 2014, 8:55pm, Wendell wrote:
I am confuse when it come to the IF ,THEN, GOTO,GOSUB how to use labels.

You will find very little information on the use of labels, because they were added to BBC BASIC for Windows only to support QB2BBC (the QBASIC to BBC BASIC translator) and LB Booster (my Liberty BASIC clone). Programs written in both of those languages commonly use labels, so it was necessary for BB4W to accept them in order to make the automatic translation into BBC BASIC practical.

BBC BASIC itself traditionally doesn't support labels at all; none of the other implementations of the language - e.g. the original BBC Micro 6502 version, BBC BASIC (Z80), ARM BBC BASIC, BBC BASIC (x86) or Brandy - do so. Also, even in BB4W, labels do not work in INSTALLed or CALLed modules, which rules out their use in libraries or subprograms.

The bottom line is: you are not expected to use labels in new programs and therefore they are substantially undocumented! Check out the Tutorial chapters on Conditional Execution, Selection using CASE and Other loops: REPEAT and WHILE for how to avoid the use of GOTOs:

http://www.bbcbasic.co.uk/bbcwin/tutorial/chapter09.html
http://www.bbcbasic.co.uk/bbcwin/tutorial/chapter10.html
http://www.bbcbasic.co.uk/bbcwin/tutorial/chapter12.html

Richard.
User IP Logged

rtr
Guest
xx Re: Tutorial for BBC BASIC
« Reply #2 on: Mar 21st, 2014, 12:15pm »

on Mar 20th, 2014, 10:34pm, Richard Russell wrote:
The bottom line is: you are not expected to use labels in new programs and therefore they are substantially undocumented!

One of the undocumented features, and something which is arguably an anomaly, is that whilst this is allowed:

Code:
      IF condition% THEN 1000 

this isn't:

Code:
      IF condition% THEN (label) 

and you have to use this instead:

Code:
      IF condition% THEN GOTO (label) 

It would theoretically be possible for me to change BB4W v6 so that the second example does work. Like all such modifications it would inevitably slow down execution slightly. Is it something you think I should consider?

Richard.
User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: Tutorial for BBC BASIC
« Reply #3 on: Mar 21st, 2014, 4:05pm »

on Mar 21st, 2014, 12:15pm, Richard Russell wrote:
...
this isn't:

Code:
      IF condition% THEN (label) 


It would theoretically be possible for me to change BB4W v6 so that the second example does work. Like all such modifications it would inevitably slow down execution slightly. Is it something you think I should consider?


Hi Richard,

My tuppence:

If it would slow down *all* IF..THEN statements (or those calling a procedure/function), then I would say definitely not: an additional note in the manual that GOTO is required with a label would be adequate.

If it would only slow down explicit or implicit GOTOs, then I don't greatly care. However, it seems to me (but what do I know) a lot of effort to have to parse the bit after THEN to see if it's a label when it almost never will be - or is there no other situation in which it could start with a bracket?

Best wishes,

D
User IP Logged

Edja
Developer

member is offline

Avatar




PM


Posts: 60
xx Re: Tutorial for BBC BASIC
« Reply #4 on: Mar 21st, 2014, 7:12pm »

on Mar 21st, 2014, 12:15pm, Richard Russell wrote:
It would theoretically be possible for me to change BB4W v6 so that the second example does work. Like all such modifications it would inevitably slow down execution slightly. Is it something you think I should consider?


The statement IF ... THEN GOTO (label) doesn't add anymore to the value of BB4W and only encourages bad programming habits.

IF... THEN... ELSE + the different loops : REPËAT ... UNTIL, FOR ... NEXT, WHILE... ENDWHILE + the CASE statement provide us with ample and better alternatives for well structured programming. The concepts of PROC's and FN's are absolutely within the reach of even the beginning programmer if willing to look at a tutorial.

If you want to incorporate this in V6 you may spread yourself to thin to implement a feature that virtually no-one will use at the cost of speed of execution and your personal available time that could otherwise be spent on more "worthy causes"

Please don't consider it.
Eddy
User IP Logged

rtr
Guest
xx Re: Tutorial for BBC BASIC
« Reply #5 on: Mar 21st, 2014, 10:35pm »

on Mar 21st, 2014, 4:05pm, DDRM wrote:
or is there no other situation in which it could start with a bracket?

My assumption is that there isn't - unless you know different! Because of the way labels were shoehorned in you get inconsistencies like this:

Code:
      PRINT "Hello "; : (ignored) PRINT "world!" 

The 'label' is completely ignored (apart from a slight execution-time penalty); it can't be used as the destination of a GOTO because it's not at the start of a line. Effectively it's like a mid-line comment!

Richard.

User IP Logged

Wendell
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Re: Tutorial for BBC BASIC
« Reply #6 on: Mar 21st, 2014, 11:01pm »

That information was so valuable to me. My grandkids and i finish the project "Tenmads Math Quiz" Thanks to you and the others
Wendell
User IP Logged

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

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls