Sunday, May 19

End Statement

The END statement terminates program execution , closes all files and returns to the command level.
Syntax
END

  • Generally, the END statement indicates the end of a BASIC program.
  • END statement may be placed any where in the program to terminate execution.
  • END closes all files.
  • GW - BASIC always returns to the command level after END is executed.
Example 2

      .            .
      .            .
      .            .
100 End
It ends the program and returns to the command level.
Ok
LIST  
10   REM Learning use of END statement
20   REM Values of two numbers X and Y
30   X = 20
40   Y = 10
50   REM Addition of two numbers X and Y
60   A = X+Y
70  END
Ok
RUN
Ok


Diplay on the screen for END statement

Ok
LIST
10  REM Learning the use of END statement
20  REM Values of Base and Height of a triangle
30  B = 2
40  H = 4
50  REM Area of the triangle
60  A = 1/2*B*H 
70  END
Ok
RUN
Ok    
      

No comments:

Post a Comment