Siz Education||programming in GW-Basic || by @sualeha on 13/12/21 on

in Steem Infinity Zone3 years ago (edited)

||20% benificiy set to @siz-official ||


Hello Everyone

Today I like to share about Programming in GW-Basic .In this blog we would learn about the Syntex of same commands and statements used in GW-BASIC .we also learn to write some simple programs in GW-BASIC. The program is popular version of of BASIC .

Important Commands in GW-BASIC

Commands are instructions that tell us the computer to perform a specific action .The same command can be used in the same from with any program.now we learn about the function and Syntex of some useful commands in GW-BASIC .Commands are always typed in Capita letters .

The CLS Command

The CLS Command is used for cleaning the screen

Syntex : CLS

The list Command

The list command display the whole program or Part of program that the computer is currently running .This is useful because it enable us to have a look at the Programm to spot any errors. We can also press the F1 key to run the LIST Command .

Syntex : LIST (to list all lines in program)

LIST -15 (to list lines 1-15 only )
LIST 10 -15 (to list lines 10-15 for program)

  • The LOAD command
    The load command is used to transfer a program from a secondary storage medium to primer stages.The computer has to close all running programs before laoding a new program .Once the program has been laoded it can be executed this means that the computer can start reading the program and follow it's instructions.

Syntex : LOAD"< filename >"['R]

  • The save command
    The save command is used to save a program .It is important to specify the name of the program .,if the storage device already stores another file by same ,the computer name the computer will replace the old file with the program file .

Syntex :SAVE "< filename >"

  • The run command
    The RUN command is used to excetue a program .We can either run a command from the very beginning or from a specific line again the computer closet all open files before running a new program .
    Syntax : RUN< line number >(run a program from specific line number )
    RUN "< filename >"(to run program from the very beginning )
Important Statement in GW -BASIC

Statements are instructions that tell the computer to perform an action that is unique to the program being run .Each statement has the same Syntex but it's included within the program . Almost every line of instruction in a program begin with a statement .
Let's talk about the function and Syntex of some useful statement in GW-BASIC.

The REM statement ,The INPUT statement , The PRINT statement ,The LOCATE statement , The LET statement ,The READ statement ,The DATA statement ,The IF...THEN ... ELSA statement , The GOTO statement , The END statement .

Creating programs in GW-BASIC

Now that we know how to use important command and statements in GW-BASIC,we will see how can we creat and run programs using these statements and commands .Each Instruction in a program is written on a separate line .we began each line with a line number .the line number tell the computer which instructions to follow first and so on .

For example program to find the area of a rectangle

10 CLS
20LOCATE 3,2:IN PUT "ENTER THE LENGTH"
30 LOCATE 4,2: "INPUT THE BREADTH"
40 LET A = L*B
50 LOCATE 7,20: PRINT "AREA OF RECTANGLE IS";A
60 END

IMG_20211213_105346_430.jpg

How we learned

  • The same command can be used in the same form with any program.
  • The CLS command used for cleaning the screen .
  • The LIST command is used to transfer a program from a secondary storage medium to primary storage .
    The SAVE command is used to save command .
  • The RUN comnand is used to execute a program.
  • The RAM statement is used to insert a remark or comment bin program .
    We used the INPUT statement to program the computer so that it asks us for the next input.
  • The GETO statement tells the computer to go to a specific line the program we can spicify line by its line number .
  • The END statement is used to tell the computer that the program has ended.
    Syntex : END

I hope you got the basic knowledge aboutGW-BASIC Programs see soon with another blog
Special thanks to @vvarishayy ,@suboohi @ashkan for guidance .
Kind regards
@sualeha

Sort:  
 3 years ago 

information about some basic commands is very helpful for beginners and learners who comes our community for learning.

 3 years ago 

Thanks yes it's specially help ful for beginners ☺️

 3 years ago 

This tutorial is most useful for me. Keep making quality contents. I hope others users are learned about the GW-BASIC language.
Thank you 💖.
Regard.
muhammadsameer

 3 years ago 

Thanks dear☺️☺️

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.030
BTC 56544.71
ETH 3000.89
USDT 1.00
SBD 2.17