0% found this document useful (0 votes)
4 views3 pages

Variables

The document explains the concept of variables and data types, highlighting their importance in coding. It provides examples of various data types such as integers, strings, booleans, and arrays, along with specific instances from a WhatsApp screenshot. The conclusion emphasizes that proper use of variables and data types enhances code performance, clarity, and maintainability.

Uploaded by

nadokaashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Variables

The document explains the concept of variables and data types, highlighting their importance in coding. It provides examples of various data types such as integers, strings, booleans, and arrays, along with specific instances from a WhatsApp screenshot. The conclusion emphasizes that proper use of variables and data types enhances code performance, clarity, and maintainability.

Uploaded by

nadokaashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

A variable is a named storage location that holds a value.

While

A data type determines the type of value a variable can hold. Common data types include:

Integers(int): whole numbers, for example, 1, 2, 3

Strings (str): sequences of characters, for example, "hello", 'hello'

Booleans (bool): true or false values

Floating-point numbers (float): decimal numbers, for example, 3.14, -0.5

Arrays/ Lists: collections of values, for example, [1, 2, 3], ("a", "b", "c")

The following are variables used in the WhatsApp screenshot and their corresponding data types:

1. Contact Names / Group Names

Example: David, BCK OLD BOYS REUNION PODIUM, Hope

Data Type: String (Text format)

2. Last Messages / Message Previews


Example: "Man I'm stressed because of this retake ", "Accident", "Evening To"

Data Type: String (Text format)

3. Unread Message Count

Example: 1, 3 (Inside green circles)

Data Type: Integer (Whole numbers)

4. Timestamps / Dates

Example: 11:33, 2/9/25, 1/31/25

Data Type: String or Datetime (Could be stored as a String or Datetime format)

5. Profile Pictures / Group Icons

Example: Circular profile pictures of contacts/groups

Data Type: Image File (Binary Data)

6. Message Type Indicators

Example: Speaker icon indicating a voice message

Data Type: Boolean (True for voice message, False otherwise)

7. Tabs / Filters

Example: Unread, Favorites, Groups

Data Type: String

8. Emoji Usage

Example: (Used in messages)

Data Type: String (Emojis are Unicode characters, stored as text)

Table showing Data Types in the Image above

ELEMENTS DATATYPE

Contact Names String

Last Messages String


Unread Message Count Integer

Timestamps/Dates String or Datetime

Profile Pictures Image File (Binary)

Message Type Indicator Boolean

Tabs/Filters String

Emojis String (Unicode)

In conclusion, variables and data types is essential for efficient and error-free coding. Variables act as
storage locations for data, while data types define the kind of data a variable can hold, such as integers,
floats, strings, and booleans. Choosing the correct data type enhances performance and prevents errors in
computations and operations. Proper use of variables and data types ensures code clarity, maintainability,
and scalability, making it easier to debug and optimize.

You might also like