<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-26816204</id><updated>2024-03-08T08:05:11.740-08:00</updated><title type='text'>Using Liberty Basic</title><subtitle type='html'>This blog documents my experiences using Liberty Basic to create some simple windows programs.&lt;br/&gt;&lt;br/&gt;&#xa;&#xa;The official homepage for Liberty Basic can be found at &lt;a href=&quot;http://www.libertybasic.com&quot;&gt;http://www.libertybasic.com&lt;/a&gt;.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-26816204.post-114982236061045790</id><published>2006-06-08T20:03:00.000-07:00</published><updated>2006-06-08T20:06:00.610-07:00</updated><title type='text'>Forum: Liberty BASIC for QBASIC Programmers</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;I stumbled across this forum today &lt;a href=&quot;http://www.libertybasic.com/qbasic/index.php&quot;&gt;Liberty BASIC for QBASIC Programmers&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;At time of writing, users don&#39;t seem to have posted to this forum recently. Perhaps the forum is at least still being read by people from time to time -- I hope so. I&#39;m writing a post about this forum because I do think there are some good (and simple) example programs on it. Even if usage of this forum doesn&#39;t pick up, I do think it is still useful as a place of reference for people trying to learning Liberty Basic.&lt;br /&gt;&lt;br /&gt;Have fun.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114982236061045790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114982236061045790' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114982236061045790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114982236061045790'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/06/forum-liberty-basic-for-qb_114982236061045790.html' title='Forum: Liberty BASIC for QBASIC Programmers'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114965395918295421</id><published>2006-06-06T21:08:00.000-07:00</published><updated>2006-06-06T21:19:19.190-07:00</updated><title type='text'>I&#39;ve now purchased Liberty Basic 4.03 GOLD.</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;This is just to let you know that I&#39;ve now bought a gold license for Liberty Basic 4.03.  I encourage readers of this blog to also purchase a copy (or upgrade if you are using an earlier version).&lt;br /&gt;&lt;br /&gt;As I&#39;m sure you are all aware, you can get the latest version of Liberty Basic from &lt;a href=&quot;http://www.libertybasic.com&quot;&gt;http://www.libertybasic.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Anyway, I&#39;ll continue with my regular posts covering how to use Liberty Basic in due course.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114965395918295421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114965395918295421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114965395918295421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114965395918295421'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/06/ive-now-purchased-liberty-basic-403.html' title='I&#39;ve now purchased Liberty Basic 4.03 GOLD.'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114904832094239696</id><published>2006-05-30T20:40:00.000-07:00</published><updated>2006-05-30T21:05:20.966-07:00</updated><title type='text'>Catching the &#39;Divide By Zero&#39; Error</title><content type='html'>In my earlier post &#39;Simple Math&#39; (dated 30th April 2006), I mentioned that your program would crash if you try to divide something by zero.  Correction, your program will crash if you divide something by zero &lt;u&gt;and&lt;/u&gt; you don&#39;t catch the &#39;Divide By Zero&#39; error.&lt;br /&gt;&lt;br /&gt;Here is an example program that shows you how to catch the &#39;Divide By Zero&#39; error.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&lt;br /&gt;&#39; ==================================&lt;br /&gt;&#39;  Catching a Divide By Zero Error&lt;br /&gt;&#39; ==================================&lt;br /&gt;&#39; Description:&lt;br /&gt;&#39; This program demonstrates the use&lt;br /&gt;&#39; of Liberty Basic&#39;s &#39;On Error&#39;&lt;br /&gt;&#39; construct to catch the &#39;Divide By Zero&#39;&lt;br /&gt;&#39; error condition.&lt;br /&gt;&#39;&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 29th May 2006&lt;br /&gt;&lt;br /&gt;&#39; Constants&lt;br /&gt;&#39; ===========&lt;br /&gt;&#39; The value of the following costant was&lt;br /&gt;&#39; taken from Alyce Watson&#39;s ebook (Liberty&lt;br /&gt;&#39; BASIC 4 Companion).  Apparently, 11 is&lt;br /&gt;&#39; the error code for the &#39;Divide By Zero&#39;&lt;br /&gt;&#39; error condition.&lt;br /&gt;Const.DivideByZero = 11&lt;br /&gt;&lt;br /&gt;&#39; Variables&lt;br /&gt;&#39; ============&lt;br /&gt;&lt;br /&gt;&#39; The first number entered by the user&lt;br /&gt;Num1 = 0&lt;br /&gt;&#39; The second number entered by the user&lt;br /&gt;Num2 = 0&lt;br /&gt;&lt;br /&gt;&#39; The result after dividing Num1 by Num2&lt;br /&gt;Result = 0&lt;br /&gt;&lt;br /&gt;&#39; Set the &#39;On Error&#39; handler&lt;br /&gt;On Error Goto [TellUserOff]&lt;br /&gt;&lt;br /&gt;&#39; Output some explanatory text to the user&lt;br /&gt;print &quot;This program will ask you for two numbers.&quot;&lt;br /&gt;print &quot;It will then display the result of...&quot;&lt;br /&gt;print &quot;Num1 / Num2&quot;&lt;br /&gt;print &quot;&quot;&lt;br /&gt;print &quot;Note: This program will tell you off if you&quot;&lt;br /&gt;print &quot;specify zero (0) as the second of the two&quot;&lt;br /&gt;print &quot;numbers.&quot;&lt;br /&gt;print &quot;&quot;&lt;br /&gt;&lt;br /&gt;&#39; Get the two numbers&lt;br /&gt;input &quot;Please enter a number: &quot;; Num1&lt;br /&gt;input &quot;Please enter another number: &quot;; Num2&lt;br /&gt;print &quot;&quot;&lt;br /&gt;&lt;br /&gt;&#39; Perform the calculation&lt;br /&gt;Result = Num1 / Num2&lt;br /&gt;&lt;br /&gt;&#39; Output the result.&lt;br /&gt;print &quot;Num1 divided by Num2 equals &quot;; Result&lt;br /&gt;Goto [end]&lt;br /&gt;&lt;br /&gt;[TellUserOff]&lt;br /&gt;&#39; Sanity check - double check that the error&lt;br /&gt;&#39; in question was the &#39;Divide By Zero&#39; error.&lt;br /&gt;if Err = Const.DivideByZero then&lt;br /&gt;    print &quot;You can&#39;t divide a number by zero!  I&quot;&lt;br /&gt;    print &quot;told you this before.  What&#39;s wrong&quot;&lt;br /&gt;    print &quot;with you?&quot;&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;[end]&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A crucial point to note about the above program is that we have set an &#39;On Error&#39; handler. The &#39;Divide By Zero&#39; error condition is just one kind of error that can potentially occur while your program is running.  Another common one is the &#39;File Not Found&#39; error (which occurs if your program tries to open a file that doesn&#39;t exist).  Each of the different error conditions that can be handled in your program has a unique error code associated with it.  As should be clear from the program above, the error code for the &#39;Divide By Zero&#39; error is 11.  Just for your information, the error code for the &#39;File Not Found&#39; error is 53.  As part of the &#39;On Error&#39; construct, you need to specify somewhere for the code to go to if an error arises.  In our example above, we specified that if an error occurs, we want program execution to jump to the lable named &#39;TellUserOff&#39;.  The rest of the code should be pretty self-explanatory.&lt;br /&gt;&lt;br /&gt;I hope you found this post useful.&lt;br /&gt;&lt;br /&gt;Please leave me some comments to let me know what you think of it.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114904832094239696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114904832094239696' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114904832094239696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114904832094239696'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/05/catching-divide-by-zero-error.html' title='Catching the &#39;Divide By Zero&#39; Error'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114852829830483959</id><published>2006-05-24T19:49:00.000-07:00</published><updated>2006-05-25T20:15:35.196-07:00</updated><title type='text'>Looping using the &#39;For&#39; loop.</title><content type='html'>Seeing as I have just given an example of how to use the &#39;do while&#39; loop, I may as well quickly give an example of how to use the &#39;for&#39; loop.  I will use the same example of needing to read in 10 numbers and then print out the sum.&lt;br /&gt;&lt;br /&gt;Here is the program using the &#39;for&#39; loop.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; ==================================&lt;br /&gt;&#39;  Demonstration Of The &#39;For&#39; Loop&lt;br /&gt;&#39; ==================================&lt;br /&gt;&#39; Description:&lt;br /&gt;&#39; This program demonstrates the use of&lt;br /&gt;&#39; the &#39;for&#39; loop to read in 10 numbers&lt;br /&gt;&#39; from the user.  The sum of the 10&lt;br /&gt;&#39; numbers is calculated and output at&lt;br /&gt;&#39; the end of the program.&lt;br /&gt;&#39;&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 24th May 2006&lt;br /&gt;&lt;br /&gt;&#39; Variables&lt;br /&gt;&#39; ============&lt;br /&gt;&lt;br /&gt;&#39; The number of items to read in&lt;br /&gt;NumItemsToRead = 10&lt;br /&gt;&lt;br /&gt;&#39; The current total&lt;br /&gt;Total = 0&lt;br /&gt;&lt;br /&gt;&#39; Loop until we have read in the required&lt;br /&gt;&#39; number of items.&lt;br /&gt;for i = 1 to NumItemsToRead&lt;br /&gt;    if i = 1 then&lt;br /&gt;        input &quot;Please enter a number: &quot;; InputNumber&lt;br /&gt;    else&lt;br /&gt;        input &quot;Please enter another number: &quot;; InputNumber&lt;br /&gt;    end if&lt;br /&gt;&lt;br /&gt;    &#39; Update the current total&lt;br /&gt;    Total = Total + InputNumber&lt;br /&gt;next&lt;br /&gt;&lt;br /&gt;&#39; Print out the total&lt;br /&gt;print&lt;br /&gt;print &quot;The sum of the &quot;; NumItemsToRead; &quot; numbers you entered is &quot;;&lt;br /&gt;print Total; &quot;.&quot;&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Points to note about the &#39;for&#39; loop are...&lt;br /&gt;&lt;br /&gt;1) The use of the &#39;for&#39; and &#39;next&#39; keywords.&lt;br /&gt;&lt;br /&gt;2) The variable that will be used as the counter. &lt;br /&gt;&lt;br /&gt;3) The start value of the counter and the end value of the counter.&lt;br /&gt;&lt;br /&gt;As you can see, the &#39;for&#39; loop is really simple to use and ideal for cases where you just want to iterate over a piece of code a certain number of times.  It is pretty common practice to use simple variables names with for loops (like &lt;code&gt;i&lt;/code&gt; in my example above).  Normally, you are encouraged to use very descriptive names for your variables, but in the case of the &#39;for&#39; loop, we know the variable is just going to be some kind of counter so we can make an exception here and keep it simple.  I used a variable called &lt;code&gt;i&lt;/code&gt; because this seems to have developed into the most commonly used variable name for &#39;for&#39; loops.  By sticking with convention, other programmers will find it easier to read and maintain my code (should they need to).  Note: the letter &#39;i&#39; can at least be seen to be an abbreviation of the word &#39;index&#39;. :-).&lt;br /&gt;&lt;br /&gt;There you go.  You have now officially been introduced to the three main types of loops provided by Liberty Basic.&lt;br /&gt;&lt;br /&gt;Have fun with your programming.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114852829830483959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114852829830483959' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114852829830483959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114852829830483959'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/05/looping-using-for-loop.html' title='Looping using the &#39;For&#39; loop.'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114852503722016565</id><published>2006-05-24T18:59:00.000-07:00</published><updated>2006-05-24T20:42:24.973-07:00</updated><title type='text'>Looping using the &#39;Do While&#39; loop</title><content type='html'>In the last post we saw how we could use the &#39;while&#39; loop to execute a section of code multiple times.  Our example was that of needing to read in 10 numbers and printing out the sum of those numbers.  In this post we&#39;ll see how we could have implemented the same functionality using the &#39;do while&#39; loop.  There was nothing intrinsically wrong with our earlier implementation using the &#39;while&#39; loop, I&#39;m just using the same functional requirements to illustrate the use of the &#39;do while&#39; loop also.&lt;br /&gt;&lt;br /&gt;Here is our example program demonstrating the use of Liberty Basic&#39;s &#39;do while&#39; loop.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; =======================================&lt;br /&gt;&#39;  Demonstration Of The &#39;Do While&#39; Loop&lt;br /&gt;&#39; =======================================&lt;br /&gt;&#39; Description:&lt;br /&gt;&#39; This program demonstrates the use of&lt;br /&gt;&#39; the &#39;do while&#39; loop to read in 10 numbers&lt;br /&gt;&#39; from the user.  The sum of the 10&lt;br /&gt;&#39; numbers is calculated and output at&lt;br /&gt;&#39; the end of the program.&lt;br /&gt;&#39;&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 24th May 2006&lt;br /&gt;&lt;br /&gt;&#39; Variables&lt;br /&gt;&#39; ============&lt;br /&gt;&lt;br /&gt;&#39; The number of items to read in&lt;br /&gt;NumItemsToRead = 10&lt;br /&gt;&lt;br /&gt;&#39; We are currently reading in item #CurrentNum&lt;br /&gt;CurrentNum = 1&lt;br /&gt;&lt;br /&gt;&#39; The current total&lt;br /&gt;Total = 0&lt;br /&gt;&lt;br /&gt;&#39; Loop until we have read in the required&lt;br /&gt;&#39; number of items.&lt;br /&gt;do&lt;br /&gt;    if CurrentNum = 1 then&lt;br /&gt;        input &quot;Please enter a number: &quot;; InputNumber&lt;br /&gt;    else&lt;br /&gt;        input &quot;Please enter another number: &quot;; InputNumber&lt;br /&gt;    end if&lt;br /&gt;&lt;br /&gt;    &#39; Update the current total&lt;br /&gt;    Total = Total + InputNumber&lt;br /&gt;&lt;br /&gt;    &#39; Update the counter&lt;br /&gt;    CurrentNum = CurrentNum + 1&lt;br /&gt;loop while CurrentNum &lt;= NumItemsToRead&lt;br /&gt;&lt;br /&gt;&#39; Print out the total&lt;br /&gt;print&lt;br /&gt;print &quot;The sum of the &quot;; NumItemsToRead; &quot; numbers you entered is &quot;;&lt;br /&gt;print Total; &quot;.&quot;&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The main points to note about the &#39;do while&#39; loop are...&lt;br /&gt;&lt;br /&gt;1) The &#39;do&#39;, &#39;loop&#39; and &#39;while&#39; keywords.&lt;br /&gt;&lt;br /&gt;2) The fact that when you use the &#39;do while&#39; loop as shown, you guarantee that your loop will always execute at least once.  This is because the check of whether to execute another iteration of the loop is placed &lt;span style=&quot;font-weight:bold;&quot;&gt;after&lt;/span&gt; the main body of the loop.  Compare this with the regular &#39;while&#39; loop that performs the check first and only executes the loop body afterwards.  To my mind, this difference of whether the loop will always run at least once or not, is the main distinction between the two loops -- If you need your loop to always execute at least once, use the &#39;do while&#39; loop, otherwise, use the regular &#39;while&#39; loop.&lt;br /&gt;&lt;br /&gt;I hope that makes some sense.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114852503722016565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114852503722016565' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114852503722016565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114852503722016565'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/05/looping-using-do-while-loop.html' title='Looping using the &#39;Do While&#39; loop'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114741101615798714</id><published>2006-05-11T21:28:00.000-07:00</published><updated>2006-05-24T20:43:55.200-07:00</updated><title type='text'>Looping using a  &#39;While&#39; loop</title><content type='html'>Sometimes you need your code to do something repeatedly.  Let&#39;s say you are writing a program to calculate the total of 10 numbers.  Rather than writing 10 lines of code that read in a number and 10 lines of code that add the latest number to the current total, you could use a loop instead.  Liberty Basic offers three kinds of loops... 1) The &#39;while&#39; loop, 2) the &#39;do while&#39; loop, and 3) the &#39;for&#39; loop.  In this post we will take a look at the &#39;while&#39; loop.  In later posts we can tackle the &#39;do while&#39; loop and the &#39;for&#39; loop.  Don&#39;t think I am leaving these other two loops for later because they are harder than the &#39;while&#39; loop.  The &#39;do while&#39; loop and the &#39;for&#39; loop are just as easy to understand and use.  I just like tackling one thing at a time.  The &#39;while&#39; loop is a fine place to start when you want to start introducing loops into your programs.  Anyway, so here is how it goes.  The example program below reads in 10 numbers and calculates the sum of all the numbers entered in.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; =====================================&lt;br /&gt;&#39;    Demonstration Of The While Loop&lt;br /&gt;&#39; =====================================&lt;br /&gt;&#39; Description:&lt;br /&gt;&#39; This program demonstrates the use of&lt;br /&gt;&#39; the while loop to read in 10 numbers&lt;br /&gt;&#39; from the user.  The sum of the 10&lt;br /&gt;&#39; numbers is calculated and output at&lt;br /&gt;&#39; the end of the program.&lt;br /&gt;&#39;&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 11th May 2006&lt;br /&gt;&lt;br /&gt;&#39; Variables&lt;br /&gt;&#39; ============&lt;br /&gt;&lt;br /&gt;&#39; The number of items to read in&lt;br /&gt;NumToRead = 10&lt;br /&gt;&lt;br /&gt;&#39; We are currently reading in item #CurrentNum&lt;br /&gt;CurrentNum = 1&lt;br /&gt;&lt;br /&gt;&#39; The current total&lt;br /&gt;Sum = 0&lt;br /&gt;&lt;br /&gt;&#39; Loop until we have read in the required&lt;br /&gt;&#39; number of items.&lt;br /&gt;while CurrentNum &lt;= NumToRead&lt;br /&gt;    if CurrentNum = 1 then&lt;br /&gt;        input &quot;Please enter a number: &quot;; InputNumber&lt;br /&gt;    else&lt;br /&gt;        input &quot;Please enter another number: &quot;; InputNumber&lt;br /&gt;    end if&lt;br /&gt;&lt;br /&gt;    &#39; Update the current total&lt;br /&gt;    Sum = Sum + InputNumber&lt;br /&gt;&lt;br /&gt;    &#39; Update the counter&lt;br /&gt;    CurrentNum = CurrentNum + 1&lt;br /&gt;wend&lt;br /&gt;&lt;br /&gt;&#39; Print out the total&lt;br /&gt;print&lt;br /&gt;print &quot;The sum of the &quot;; NumToRead; &quot; numbers you entered is &quot;;&lt;br /&gt;print Sum; &quot;.&quot;&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Points to note are...&lt;br /&gt;&lt;br /&gt;1) The &#39;while&#39; keyword to signify the start of the loop&lt;br /&gt;2) The expression after the &#39;while&#39; keyword.  Basically, the loop will execute as long as this expression remains true.&lt;br /&gt;3) The &#39;wend&#39; keyword to signify the end of the while loop.&lt;br /&gt;&lt;br /&gt;Also (as a side note for newbies), notice how I got the program to make a distinction between the case when we are reading in the first number compared to the case when we are reading in any of the subsequent numbers.  For the first number the program prints &quot;Please enter a number: &quot; and for the other times it prints &quot;Please enter another number: &quot;.&lt;br /&gt;&lt;br /&gt;Tip: When writing your while loops, make sure that there will be a time when the loop will exit.  Otherwise the loop will go on forever... or at least until the program or computer crashes.  In our case we used a counter called &lt;code&gt;CurrentNum&lt;/code&gt; that increments until it reaches a value of 11.  When &lt;code&gt;CurrentNum&lt;/code&gt; reaches a value of 11, the expression &lt;code&gt;CurrentNum &lt;= NumToRead&lt;/code&gt; is not true any more, and therefore the loop stops executing (doesn&#39;t perform any more iterations).  Note, that if we forgot to add the line &lt;code&gt;CurrentNum = CurrentNum + 1&lt;/code&gt;, the value of CurrentNum would have always remained as 1 and the loop would have continued indefinately (until the program crashed).&lt;br /&gt;&lt;br /&gt;Anyway, I think that is enough for one post.  I hope you enjoyed it.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114741101615798714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114741101615798714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114741101615798714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114741101615798714'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/05/looping-using-while-loop.html' title='Looping using a  &#39;While&#39; loop'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114663428122487870</id><published>2006-05-02T22:30:00.000-07:00</published><updated>2006-05-02T22:32:47.096-07:00</updated><title type='text'>Decisions Using The &#39;If&#39; Statement</title><content type='html'>Very early on in your programming, you are going to need to get the computer to do one thing if a certain condition is true, but do something else if it is not true.  Let&#39;s take a look at how we might do this in Liberty Basic.&lt;br /&gt;&lt;br /&gt;First, let&#39;s think of a very simple example we can use to illustrate this concept.  How about a program to work out how much a salesperson should get paid based on the number of items he/she sold.  Let&#39;s say that company X pays it&#39;s salespeople $15 for every DVD player they sell.  In addition to this, let&#39;s say that the company pays an additional $250 to salespeople that sell more than 1,000 DVD players in that calendar month.&lt;br /&gt;&lt;br /&gt;Here is the example program...  (as you can see, the decision logic is implemented using the &#39;if&#39;, &#39;then&#39;, &#39;else&#39; and &#39;end if&#39; keywords)...&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; Program to determine how much to pay a salesperson&lt;br /&gt;&#39; working for company x. Salespeople at this company&lt;br /&gt;&#39; earn $15 for every DVD player they sell and receive a&lt;br /&gt;&#39; bonus of $250 if they sell more than 1000 units.&lt;br /&gt;&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 30th April 2006&lt;br /&gt;&lt;br /&gt;print &quot;How many DVD players did you sell this month?&quot;&lt;br /&gt;input &quot;&gt; &quot;; NumItemsSold&lt;br /&gt;Salary = NumItemsSold * 15&lt;br /&gt;&lt;br /&gt;&#39; Now add the $250 for those that sold more than&lt;br /&gt;&#39; 1000 DVD players.&lt;br /&gt;if (NumItemsSold &gt; 1000) then&lt;br /&gt;    Salary = Salary + 250&lt;br /&gt;    print &quot;Congratulations, you will be getting a bonus this month.&quot;&lt;br /&gt;else&lt;br /&gt;    print &quot;Sorry, no bonus for you this month.&quot;&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;&#39; Print out the salary due to the saleperson.&lt;br /&gt;print &quot;This month you will be paid $&quot;; Salary; &quot;.&quot;&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I&#39;m sure you were able to understand how the &#39;if&#39; statement worked.  The &#39;else&#39; clause is optional.  For example, if we didn&#39;t want to display a message to those people that aren&#39;t going to get a bonus, we could have written the program as follows... &lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; Program to determine how much to pay a salesperson&lt;br /&gt;&#39; working for company x. Salespeople at this company&lt;br /&gt;&#39; earn $15 for every DVD player sold and receive a&lt;br /&gt;&#39; bonus of $250 if they sell more than 1000 units.&lt;br /&gt;&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 30th April 2006&lt;br /&gt;&lt;br /&gt;print &quot;How many DVD players did you sell this month?&quot;&lt;br /&gt;input &quot;&gt; &quot;; NumItemsSold&lt;br /&gt;Salary = NumItemsSold * 15&lt;br /&gt;&lt;br /&gt;&#39; Now add the $250 for those that sold more than&lt;br /&gt;&#39; 1000 DVD players.&lt;br /&gt;if (NumItemsSold &gt; 1000) then&lt;br /&gt;    Salary = Salary + 250&lt;br /&gt;    print &quot;Congratulations, you will be getting a bonus this month.&quot;&lt;br /&gt;end if&lt;br /&gt;&lt;br /&gt;&#39; Print out the salary due to the saleperson.&lt;br /&gt;print &quot;This month you will be paid $&quot;; Salary; &quot;.&quot;&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There, that wasn&#39;t too hard was it.  It may not look or feel like much, but the ability to get the computer to do different things based on different variables is a very fundamental part of programming.  Obviously, the more complex the program, the more decisions the computer has to make... but the syntax of the &#39;if&#39; statement remains the same... you will just have considerably more of them.&lt;br /&gt;&lt;br /&gt;Anyway, that&#39;s it for today.&lt;br /&gt;&lt;br /&gt;I hope you enjoyed this post.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114663428122487870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114663428122487870' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114663428122487870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114663428122487870'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/05/decisions-using-if-statement.html' title='Decisions Using The &#39;If&#39; Statement'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114646095909381601</id><published>2006-04-30T21:53:00.000-07:00</published><updated>2006-05-25T20:17:46.153-07:00</updated><title type='text'>Simple Math</title><content type='html'>In this post, we will take a look at how to get Liberty Basic to perform simple math operations.  It is REALLY easy.&lt;br /&gt;&lt;br /&gt;Addition is performed using the + operator.&lt;br /&gt;&lt;br /&gt;Subtraction is performed using the - operator.&lt;br /&gt;&lt;br /&gt;Multiplication is performed using the * operator.&lt;br /&gt;&lt;br /&gt;Division is performed using the / operator.&lt;br /&gt;&lt;br /&gt;Here is an example...&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; Simple Math In Liberty Basic&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 30th April 2006&lt;br /&gt;&lt;br /&gt;num1 = 12&lt;br /&gt;num2 = 7&lt;br /&gt;&lt;br /&gt;&#39; Let&#39;s do some addition&lt;br /&gt;result = num1 + num2&lt;br /&gt;print &quot;Result of addition: &quot;; result&lt;br /&gt;&lt;br /&gt;&#39; Now let&#39;s do some subtraction&lt;br /&gt;result = num1 - num2&lt;br /&gt;print &quot;Result of subtraction: &quot;; result&lt;br /&gt;&lt;br /&gt;&#39; Now let&#39;s do some multiplication&lt;br /&gt;result = num1 * num2&lt;br /&gt;print &quot;Result of multiplication: &quot;; result&lt;br /&gt;&lt;br /&gt;&#39; Finally, let&#39;s do some division&lt;br /&gt;result = num1 / num2&lt;br /&gt;print &quot;Result of division: &quot;; result&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Running this program prints the following results&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;Result of addition: 19&lt;br /&gt;Result of subtraction: 5&lt;br /&gt;Result of multiplication: 84&lt;br /&gt;Result of division: 1.71428571&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: You can also put several operators on one line.  Just like the math you were taught at school... the rules of precendence will apply.  For example, expressions are evaluated right to left and the multiplication and division operations will be evaluated before the addition and subtraction operations.  Of course,  anything in brackets, get&#39;s evaluated first.  Here are a couple of examples...&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;result = (4+2)*6-2     &#39; result will be 34 &lt;br /&gt;&lt;br /&gt;result = 4+2*6-2     &#39; result will be 14 &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;One last note.  Dividing a number by zero (0) is illegal in Liberty Basic.  You will want to stop your program from attempting to do this.  An attempt by your program to divide a number by zero will cause Liberty Basic to report a runtime error and your program will stop running.  You have been warned :-).&lt;br /&gt;&lt;br /&gt;That&#39;s it for today.  I hope you enjoyed this post.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114646095909381601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114646095909381601' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114646095909381601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114646095909381601'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/simple-math.html' title='Simple Math'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114615482949790792</id><published>2006-04-27T09:10:00.000-07:00</published><updated>2006-04-27T19:17:27.220-07:00</updated><title type='text'>Getting User Input</title><content type='html'>If you have been following me so far, we now know how to store data in our programs as well as how to output that data to the screen.  The next logical step for us is to be able to receive data from the user, and know how to store that data as variables in our programs.&lt;br /&gt;&lt;br /&gt;As this blog progresses, we&#39;ll move on to creating windows programs that use the various windows gadgets you are all used to seeing as part of a windows program.  I&#39;m talking about things like textboxes, buttons, menus, lisboxes etc.  When we discuss these components we&#39;ll also discuss how to get user input through them.  For right now, however, we are dealing with the &#39;main window&#39; that gets displayed by Liberty Basic as the default user interface for our Liberty Basic programs.&lt;br /&gt;&lt;br /&gt;So, how can we get any input from the user via this &#39;main window&#39;?  Here is an example program...&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;&#39; =============================&lt;br /&gt;&#39;     Getting User Input&lt;br /&gt;&#39; =============================&lt;br /&gt;&#39; Program to demonstrate receiving some user input.&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 27th April 2006&lt;br /&gt;&lt;br /&gt;print &quot;This program will ask you for some information.&quot;&lt;br /&gt;print &quot;After each prompt, please enter the requested information&quot;&lt;br /&gt;print &quot;and then hit &#39;Enter&#39;.&quot;&lt;br /&gt;print&lt;br /&gt;input &quot;Please enter your full name: &quot;; FullName$&lt;br /&gt;input &quot;Please enter your age: &quot;; Age&lt;br /&gt;print&lt;br /&gt;print &quot;Your name is &quot;; FullName$; &quot; and you are &quot;; Age; &quot; years old.&quot;&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When you run this program the following is printed...&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;This program will ask you for some information.&lt;br /&gt;After each prompt, please enter the requested information&lt;br /&gt;and then hit &#39;Enter&#39;.&lt;br /&gt;&lt;br /&gt;Please enter your full name:&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The program then waits until you enter your name and hit the &#39;Enter&#39; (Return) key.  Actually, technically, the program only waits until you hit the &#39;Enter&#39; key.  Basically, anything you type before hitting the &#39;Enter&#39; key is stored in the variable &lt;code&gt;FullName$&lt;/code&gt;.  If you didn&#39;t enter anything and just hit the enter key, nothing (the empty string &quot;&quot;), will be stored in the &lt;code&gt;FullName$&lt;/code&gt; variable.    Anyway, after hitting the &#39;Enter&#39; key, the program then continues running.  It then displays the following (see below) and again waits for user input.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;font-size: 8pt&quot;&gt;&lt;br /&gt;Please enter your age: &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This time, anything entered before the &#39;Enter&#39; key is hit will be placed in the &lt;code&gt;Age&lt;/code&gt; variable.  Note: In this case the variable in question is expected to have a value that is a number.  Do you remember why? It is because the variable &lt;code&gt;Age&lt;/code&gt; was defined without a trailing dollar sign ($).  If it had been defined with a trailing dollar sign ($), then we (and the Liberty Basic compiler) would know to expect a string.  You may ask why I am pointing this out.  I&#39;m mentioning this because users don&#39;t always do what we expect them to.  For example, a 30 year old user using our program might type in &quot;thirty&quot; instead of the numerical 30 that we are expecting.  If they did do this, the &lt;code&gt;Age&lt;/code&gt; variable would be set to contain the default value of 0 (because the user didn&#39;t enter a number at all... or at least, they didn&#39;t enter a number in numerical form).  Interestingly, if the user typed in a string that &lt;span style=&quot;font-weight:bold;&quot;&gt;started&lt;/span&gt; with a number, that number at the beginning of the string would be used.  For example, if the user entered an age of &quot;9.5inches&quot;, the value 9.5 would be stored in the &lt;code&gt;Age&lt;/code&gt; variable.  It is good practice to always check the validity of the input into your program.  In our case, we probably would want to check that the user did actually enter a name and that they also entered a valid number as their age.  This issue of input validation is a subject in it&#39;s own right.  I&#39;m sure I will tackle it in a later post.  Leave me a comment if this is something you would be interested in me covering.&lt;br /&gt;&lt;br /&gt;Anyway, I think that&#39;s it for now.  I hope you enjoyed this post.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Eddie&lt;br /&gt;&lt;br /&gt;P.S.  One other point to note about my program in this post.  There are a couple of lines that only contain the &#39;print&#39; command and nothing else.  These are used just to print out a new line for spacing purposes. If you look at the example output I provided above, you should be able to see what I mean (e.g. there is a blank line between the header information and the first question the program asks).</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114615482949790792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114615482949790792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114615482949790792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114615482949790792'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/getting-user-input.html' title='Getting User Input'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114603034583292200</id><published>2006-04-25T22:05:00.000-07:00</published><updated>2006-04-26T17:52:14.513-07:00</updated><title type='text'>Variables</title><content type='html'>Variables are used in programming languages to reference pieces of data.  For example, you may have a variable called &lt;code&gt;age&lt;/code&gt;, to store data about a person&#39;s age... or you may have a variable called &lt;code&gt;IQ&lt;/code&gt;, to store data about someone&#39;s IQ.  Equally, you can use variables to store things like someone&#39;s eye color e.g. &quot;brown&quot;.  What data you store in your program is up to you and dependant on the program you want to write.  The names of your variables are also up to you, but it is good programming practice to give the variables in your programs names that describe the data they store, as per my examples above.  &lt;br /&gt;&lt;br /&gt;As far as data types are concerned, Libery Basic provides two types of variable... 1) Strings... 2) Numbers...&lt;br /&gt;&lt;br /&gt;For those of you that don&#39;t know, a string is a sequence of characters.  Examples of strings are... &quot;Fred&quot;, &quot;Wilma&quot;, &quot;Fred and Wilma&quot;, &quot;Apples&quot;, &quot;Oranges&quot; as well as &quot;59 apples and 39 oranges&quot;.  Note that strings can contain punctuation marks, spaces, numbers and other symbols like the dollar sign ($) or special characters like the copyright sign (©).  A string is specified in a program by enclosing a sequence of characters in double quotes (&quot;), e.g. &quot;This is a string&quot;.&lt;br /&gt;&lt;br /&gt;Now, what about these numbers???  Many programming languages make a distinction between integers and decimals.  Integers are whole numbers (i.e. numbers without a decimal point) and decimals are, well, numbers that do have a decimal point.  Anyway, Liberty Basic likes to keep things simple and does not make you distinguish between these two types of numbers in your programs.  Example values for a &#39;number&#39; variable are therefore... 20, 30, 40, 9.5, 10.8 and 63.5291... you get the picture.&lt;br /&gt;&lt;br /&gt;So, how do you define and use these variable thingies.  It&#39;s simple.  Take a look at the example below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&#39; =======================&lt;br /&gt;&#39;     Using Variables&lt;br /&gt;&#39; =======================&lt;br /&gt;&#39; Program to demonstrate using variables.&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 25th April 2006&lt;br /&gt;&lt;br /&gt;&#39; Setup a &#39;name&#39; variable&lt;br /&gt;name$ = &quot;Eddie Meyer&quot;&lt;br /&gt;&lt;br /&gt;&#39; Setup an &#39;age&#39; variable&lt;br /&gt;age = 30&lt;br /&gt;&lt;br /&gt;&#39; Use both of these variables in a couple of&lt;br /&gt;&#39; print statements&lt;br /&gt;print &quot;Hello &quot;; name$; &quot;.&quot;&lt;br /&gt;print &quot;Apparently you are &quot;; age; &quot; years old.&quot; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Running this program, prints the following on the screen.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Hello Eddie Meyer.&lt;br /&gt;Apparently you are 30 years old.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, there are a couple of things to note.&lt;br /&gt;&lt;br /&gt;1) Variable names must always start with a letter (never a number).&lt;br /&gt;2) After the fist character in the variable name, numbers may be used.&lt;br /&gt;3) String variables must always end with a dollar sign ($).&lt;br /&gt;4) Number variables must never end with a dollar sign ($) (because if the variable ended in a dollar sign, Liberty Basic would expect a string value and not a number).&lt;br /&gt;5) You can use the semi-colon character (;) alongside your &#39;print&#39; commands so that you can print multiple things on one line.&lt;br /&gt;&lt;br /&gt;OK, I think that&#39;s enough for now.  I hope you enjoyed this post.  Feel free to leave some comments to let me know what you think.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114603034583292200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114603034583292200' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114603034583292200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114603034583292200'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/variables.html' title='Variables'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114594035209066439</id><published>2006-04-24T21:30:00.000-07:00</published><updated>2006-04-26T02:46:24.310-07:00</updated><title type='text'>Commenting Your Code</title><content type='html'>As I am sure you are aware, it is extremely recommended for you to comment the code you write (both so that others can understand your code more easily, and also so that you can make sense of your own code more quickly when you come back to it after a break of more than a couple of months).&lt;br /&gt;&lt;br /&gt;So, how do you comment your code in Liberty Basic?  It&#39;s simple, all you have to do is prefix your comment with an apostrophe (&#39;).  If your comment spans multiple lines, make sure each line has it&#39;s own apostrophe to indicate the start of the comment on that line.&lt;br /&gt;&lt;br /&gt;Let&#39;s demostrate this by way of example.  How about we add some comments to the &quot;Hello World&quot; program we created in the last post.  Here is what our new version of the program might look like.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&#39; =================================&lt;br /&gt;&#39;    Simple Hello World Program&lt;br /&gt;&#39; =================================&lt;br /&gt;&#39; Author: Eddie Meyer&lt;br /&gt;&#39; Date: 24th April 2006&lt;br /&gt;&lt;br /&gt;print &quot;Hello World!&quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note:  A comment doesn&#39;t have to start at the beginning of a line.  The following comment is equally valid.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;print &quot;Hello World!&quot;   &#39; This is a comment.&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note: In this second example, since the comment occurs after the print command, the print command will still execute.  Had the apostrophe been placed before the print command, the print command would become part of the comment and would therefore not execute.&lt;br /&gt;&lt;br /&gt;That&#39;s it.  Now we don&#39;t have any excuse not to comment the code we write. :-).  I wonder what the next post might be about.  Oh well, we&#39;ll have to wait and see.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114594035209066439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114594035209066439' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114594035209066439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114594035209066439'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/commenting-your-code.html' title='Commenting Your Code'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114593763608479519</id><published>2006-04-24T20:44:00.000-07:00</published><updated>2006-04-25T08:29:17.470-07:00</updated><title type='text'>A &quot;Hello World&quot; Program</title><content type='html'>So, now it is time to start learning how to program in Liberty Basic. Traditionally the first program you write in a new language is a program to write &quot;Hello World!&quot; to the screen. So let&#39;s do that it Liberty Basic. The code goes something like this.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;print &quot;Hello World!&quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now that wasn&#39;t hard was it? I was suprised to find that running this program brought up a default window with a textbox... I&#39;m used to simple programs like this outputing to a console window. In some ways, it is kinda nice that a real window is brought up. I encourage you all (if you are learning to program Liberty Basic along with me) to try entering this example program and running it yourself. For those of you who are curious, this is what the output should look like... (click on the image to view the picture full size)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/6462/2810/1600/ScreenShot_7.jpg&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;&quot; src=&quot;http://photos1.blogger.com/blogger/6462/2810/320/ScreenShot_7.jpg&quot; alt=&quot;&quot; width=&quot;60%&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/pre&gt; Well, that&#39;s our first program written. I know it is possible to write programs that don&#39;t bring up this default window. I wonder if it is possible to bring up a console window instead (for those times when you actually want a console window). I&#39;ll leave this for another post though.&lt;br /&gt;&lt;br /&gt;I hope you enjoyed.&lt;br /&gt;&lt;br /&gt;Eddie</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114593763608479519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114593763608479519' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114593763608479519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114593763608479519'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/hello-world-program.html' title='A &quot;Hello World&quot; Program'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114584928309825417</id><published>2006-04-23T20:26:00.000-07:00</published><updated>2006-04-24T07:58:54.083-07:00</updated><title type='text'>I&#39;ve Installed The Free Trial</title><content type='html'>Hi all,&lt;br /&gt;&lt;br /&gt;Just wanted to let you know that I&#39;ve installed the free trial. So far so good. Now I have to figure out how to start programming in this language. I&#39;ll let you know how it goes.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Eddie.</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114584928309825417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114584928309825417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114584928309825417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114584928309825417'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/ive-installed-free-trial.html' title='I&#39;ve Installed The Free Trial'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-26816204.post-114584064569163235</id><published>2006-04-23T17:48:00.000-07:00</published><updated>2006-04-25T09:22:46.156-07:00</updated><title type='text'>Using Liberty Basic</title><content type='html'>Hi everyone.&lt;br /&gt;&lt;br /&gt;So, this is my first post on this blog. I guess this is a good time to explain why I created this blog. It&#39;s simple really, this blog is going to document my experience using Liberty Basic. At the moment I am completely new to Liberty Basic, but, seeing as I am a software engineer by profession, I&#39;m hoping that it won&#39;t be too hard for me to get the hang of it.&lt;br /&gt;&lt;br /&gt;So why Liberty Basic? Now that is really good question. Let&#39;s see. Well, first and foremost, I was looking for a programming language I could use to develop small programs for the PC (windows). I program in Java for a living and I am very proficient in it, so Java was definately an option. The problem with Java for me was that I really want to be able to distribute my applications as an executable (.exe). I also want to develop GUI applications that have the windows look and feel. I simply feel that the Swing components I would have used in Java have a definate Java look to them. I want my applications to look like a windows program, not a Java program that happens to be running on windows. With these kind of thoughts in mind, I went in search of another programming language to use. I definately didn&#39;t want to pay the exhorbitant prices charged by Microsoft for their latest Visual C++, Visual Basic or whatever... and I equally didn&#39;t want to pay the similarly high price for Borland&#39;s equivalent programs like Delphi or C++ Builder. No, I was definately going to need to look for something smaller... and preferably something simple too. I did teach myself a little C, just because I felt that it&#39;s important to know, but I think C is a little too low level for being able to quickly develop desktop applications. I thought about using C++... but, to be honest, I just don&#39;t like C++. It&#39;s just not elegant enough for my liking. If I was going to use C++ though, I would definately use Devshed&#39;s Dev C++. Anyway, so this left me still looking for a good development language with which to create windows programs. After much hunting around, it became clear to me that the only way I was going to know whether I liked a language or not, was to give it a go. This is where I decided to make a choice an just go with it. If I liked it, great. If I didn&#39;t like it, hopefully I would learn why I didn&#39;t like it. This is where this blog comes in. I decided that I would give Liberty Basic a whirl and write about my experiences with it. If I do really well with Liberty Basic, I will let you in on the tips and tricks I learn along the way. If I find problems with Liberty Basic, I will document them here so that others may learn from my experience. If this is the case, I will pick another language and hope for a better experience next time. Either way, I decided it was time to take action... and give something a try.&lt;br /&gt;&lt;br /&gt;Some of the reasons for me starting with Liberty Basic are...&lt;br /&gt;&lt;ol&gt;   &lt;li&gt;It seems to be frequently updated.&lt;/li&gt;   &lt;li&gt;It appears to have a strong user base.&lt;/li&gt;   &lt;li&gt;It claims to be easy.&lt;/li&gt;   &lt;li&gt;It&#39;s cheap.&lt;/li&gt;   &lt;li&gt;There seems to be quite a few plugins that have been developed by various users.&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;It has a GUI builder.&lt;/li&gt;   &lt;li&gt;It can always be extended via C if need be.&lt;br /&gt;&lt;/li&gt; &lt;/ol&gt; Anyway, so that&#39;s the background for this blog. I hope you enjoy this journey with me. Please do leave some comments on this site so that I know people are reading this blog (even if the comment is... &quot;I wish you good luck with your programming&quot;... or... &quot;Are you crazy... C++ is obviously the best language in existence&quot;, etc).&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Eddie.</content><link rel='replies' type='application/atom+xml' href='http://using-liberty-basic.blogspot.com/feeds/114584064569163235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/26816204/114584064569163235' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114584064569163235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/26816204/posts/default/114584064569163235'/><link rel='alternate' type='text/html' href='http://using-liberty-basic.blogspot.com/2006/04/using-liberty-basic.html' title='Using Liberty Basic'/><author><name>Edward Meyer</name><uri>http://www.blogger.com/profile/01353401943148643298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry></feed>