Fast Track 1.2

From BR Wiki
Revision as of 21:04, 5 August 2014 by Laura (talk | contribs) (Created page with "====List==== LIST will list the lines of your program. LIST can list line numbers, lines containing words specified in quotes, or whole programs. LIST “print” - for ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

List

LIST

will list the lines of your program.

LIST can list line numbers, lines containing words specified in quotes, or whole programs.

LIST “print” - for all occurrences of the command PRINT
LIST -P  -for page by page listing of long programs
LIST 20 50 – for lines 20 to 50

List your program:

10 print “hello world” 

Change the line number to 30 and press Enter:

30 Print “Hello World”

Add some lines, by typing:

 10 print “What is your name?”
 20 input name$

INPUT

INPUT asks for input from the user.

Change line 30 to

30 PRINT “HELLO ”&” “&name$&”!” 

RUN your program, enter your name, and voila!

Notice the use of the ampersand, you can add two variables together.

To split a string apart, you can use beginning and ending spaces:

let name$= “Johnny Cash”
let firstname$=name$(1:6)
print firstname$

will return “Johnny.”

To save a program that already exists, use REPLACE. Most commands can be shortened to their smallest unique beginning letters.

REP hello

The BR Editor

BR allows you to edit programs while they are running. The following commands will help you do this:

DEL can be used to delete lines from your program.

Typing over lines or line numbers will change them, but only using REPLACE will save your changes.

You may have already noticed that the built-in BR editor is a little hard to use.

Convert your programs to source code so that you can edit them in an external editor. Use list (and hit enter after every line).

LIST >hello.brs

External Editors

It is highly recommended that you use an external editor. If you don't already have one, download MyEditBR from Mills Enterprises, and download Lexi, which is available from Sage AX—a tool that allows you to edit without worrying about line numbers (and a few extra features) and install them both.

Open your BR program hello.brs into your editor, and move forward. Use Lexi to strip the line numbers (you can add them again too). When you hit “Compile BR program” it will automatically add the line numbers and re-create your program as a .BR for Business Rules to use, which you can run from the BR console to fully test them. Simple errors will be flushed out for you to handle when you compile it too.

Using an external editor allows you to copy and paste, move around in the text, and have much more control over the editing process than the BR console allows. </noinclude