An easy to use BASIC language
and IDE for education.

Tutorial Two

Russian Translation Coming Soon.

Tutorial Two - Doing your Math homework. . .the easy way

As you learned in the first tutorial, BASIC-256 can print messages on the screen. It can be fun to make the computer say what you want it to, but it's not really useful. Do you know what the first computers were built to do? That's right, they were made to do math. And they do it really quickly. Let's see how we can make the computer do math for us.

print 1 + 1

If you run the program, you'll see how the computer prints out 2, the correct answer. Notice how we don't put the numbers in quotation marks. Quotation marks are only used for messages. Let's see what happens if we use quotation marks anyway:

print 1 + 1
print "1 + 1"

Hey! The computer printed out 2, then "1 + 1", without adding the numbers together. Now we can see what the quotation marks do. They tell the computer to print exactly what is inside, without doing any math. So, if you want the computer to do math, don't use the quotes. Otherwise, make sure to put them in.

How about more complicated math? BASIC-256 can do that too. Try typing in these lines and see what happens:

print 1 + 2 + 3
print 3 - 2
print 2 * 2
print 4 / 2

There we go, addition, subtraction, multiplication, and division. Now, go ahead and try some math problems of your own.

Congratulations! You've finished the second tutorial. By now, you should understand:

  • How to add, subtract, multipy, and divide with BASIC-256
  • When to use quotation marks with the PRINT command

 

Find us on Facebook.    So You Want to Learn to Program?

GPL
BASIC-256 is licensed under the GNU General Public License.
Last modified: 2010-06-10, 10:47

© 2010 Contributors to the BASIC-256 Project

powered by phpSQLiteCMS

Warning: Cannot modify header information - headers already sent by (output started at /home/content/17/4039117/html/basic256/templates/b256.tpl:2) in /home/content/17/4039117/html/basic256/cms/includes/exception.inc.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at /home/content/17/4039117/html/basic256/templates/b256.tpl:2) in /home/content/17/4039117/html/basic256/cms/includes/exception.inc.php on line 13

Warning: Cannot modify header information - headers already sent by (output started at /home/content/17/4039117/html/basic256/templates/b256.tpl:2) in /home/content/17/4039117/html/basic256/cms/includes/exception.inc.php on line 14
BASIC-256 - Error

BASIC-256

Error

An error occurred while processing this directive.

Message: SQLSTATE[HY000]: General error: 11 database disk image is malformed
Code: HY000
File: /home/content/17/4039117/html/basic256/templates/renejm_accesslog.inc.php
Line: 20