Page 145 - Computer - 6
P. 145

Arithmetic Operators
            Arithmetic  operators  are  used  to  perform  arithmetic  or  mathematical  calculations  on  numeric
            constants and variables. The table given below illustrates the arithmetic operators in Small Basic.

                          Operator           Operation              Example                Result

                              +           Addition              80 + 20              100
                               -          Subtraction           80- 20               60

                              *           Multiplication        80 * 20              1600
                              /           Division              80 / 20              4


            Relational Operators
            Relational operators are used to compare two variables, constants, or expressions. It evaluates the
            result as True or False.
            Logical Operators
            Logical operators are used to combine two or more expressions containing relational operators.
            It evaluates the result as True or False. There are two logical operators in Small Basic:
            (a)  AND: The AND operator returns the result True, if all the expressions combined with it are True,
                else it returns FaIse.
            (b)  OR: The OR operator returns the result True, if any one of the expressions combined with it is
                True, else it returns False.

            Statements
            A Statement is an instruction for the computer to execute. It is made up of one or more elements of
            Small Basic program.

            Comments
            A Comment is a statement that is used to provide explanation for the code in a program. It is non-
            executable and does not produce any output. A comment begins with an apostrophe ( ‘ ).

            Objects, Properties and Methods
            An Object is anything that has properties and performs action. It is the fundamental building block
            that is used to develop programs in Small Basic. A Property describes a characteristic of an object.
            A property has a value that can be set for an object. The various actions that an object can perform
            are called its Methods. A method may use one or more data values called MethodInputs.
            You can set properties and perform methods for an object using the dot rule:
                 ObjectName.PropertyName = “PropertyValue”

                 ObjectName.MethodName(Methodlnputs)
            TextWindow Object
            The TextWindow object provides various input and output methods. Some methods used with the
            TextWindow object are:
            (a)  Writeline( ): It displays text or a number in the output window and shifts the cursor to the next line.
            (b)  Write( ): It displays text or a number in the output window and keeps the cursor at the end of the
                current line.


                                                                                                             143
   140   141   142   143   144   145   146   147   148   149   150