Fast Track 1.2: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 51: Line 51:
DEL can be used to delete lines from your program.  
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.
Typing over lines or line numbers will change them, but only if you press enter afterwards. Then, using REPLACE will save your changes if the program has been saved once already.


You may have already noticed that the built-in BR editor is a little hard to use.  
You may have already noticed that the built-in BR editor is a little hard to use.  
Line 61: Line 61:
====External Editors====
====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.  
It is highly recommended that you use an external editor. If you don't already have one, download [[MyEditBR]] from [http://www.mills-enterprise.ca/ Mills Enterprises], and download [[Lexi]], which is available from [http://www.sageax.com/index.php?option=com_content&view=article&id=60&Itemid=78 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.  
Open your BR program hello.brs in your editor, and continue with the tutorial.


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.
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 editor allows.


<noinclude>
<noinclude>
[[Category:Fast Track Tutorial]]
[[Category:Fast Track Tutorial]]
</noinclude
</noinclude>

Latest revision as of 18:23, 10 September 2014

List

LIST will list the lines of your program.

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

LIST
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 if you press enter afterwards. Then, using REPLACE will save your changes if the program has been saved once already.

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 in your editor, and continue with the tutorial.

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 editor allows.