Sunday, February 2, 2025

Variable, Data Types and Operators in Coding.

 1. Variables:

- data/information that can change its value.

- it has: a. name/label

               b. value

                c. data type

                    d. place to store


2. Data types:

a. Integer/Int: Non-fractional number, eg, age=24, salary= 20000

b. Float: Fractional number, eg, percent=87.5

c. String: 'Test' eg, name= "Ram'

d. Boolean: Yes/No, True/False

e.  Car/Character: single letter or character eg, 'x', 'y'


3. Operators:

-establish relation between variable and value

a. Relational: <, >, <=, >=, ==, !=

b. Mathematical:+,-,*,/

c. Logical: and, or, not (&&,||, !)

d. Assignment:=,+=,-=,*= (c+=5 ie c=c+5)


Types of language:

a. Strongly type language ( Java, C#, C++): must declare the type of data and can't change data type but only value

b.  Loosely type language (Python): don't have to declare data type and can change both data type and value

No comments:

Post a Comment