Previous topic First topic

Producing nicely formatted code automatically
 
Assist adds a source code formatter to the Liberty BASIC editor.  It realigns the left alignment of a program's source code and places levels of functionality in nested indentations.  This is useful when working alone, and especially if several people work together on a project so that there is an easily available standard format for source code.
 
Just to demonstrate how this works, let's type in a small program and then we'll format it.  Here is a short and simple program without any indentation.
 
'formatting example
print "my simple counter"
[loop]
count = count + 1
print "count now "; count
for x = 1 to 3
if x = count then
print word$("one two three", x)
end if
next x
if count < 3 then [loop]
end
 
Here's what we see before we format the code.
 
Image Image48.GIF
No formatting = hard to read
 
 
Let's make the program much clearer now.  Use the File+Tools+Code Formatter menu (or type Alt+O) and Assist will automatically format the program to the following.
 
Image Image49.GIF
Now much clearer
 
Each level of structure is indented inside of the one that contains it.
 
 


Copyright 1992-2009 Shoptalk Systems