What are data types?
Define the basic Data types.
@bharatupadhyay Unlike humans, a computer does not know the difference between “1234” and “abcd.” A data type is a classification that dictates what a variable or object can hold in computer programming. Data types are an important factor in virtually all computer programming languages
Common examples of data types
Boolean (e.g., True or False)
Character (e.g., a)
Date (e.g., 03/01/2016)
Double (e.g., 1.79769313486232E308)
Floating-point number (e.g., 1.234)
Integer (e.g., 1234)
Long (e.g., 123456789)
Short (e.g., 0)
String (e.g., abcd)
Void (e.g., no data)
A data type, in programming, is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error.
A datatype is a classification that specifies the type of value/data that a variable holds.
Datatypes can be classified into two types:
- Primitive
- String: “Akshaj”, “hello”
- Number: 45, 9.2, 1
- Boolean: True, False
- Null
- Undefined: No value has been assigned
- Symbol
- Non-primitive
- Object: Person = {age: 21, name: “akshaj”}
- Array: numbersTillFive = [0,1,2,3,4,5]
- Function: drawCircle()
The above given datatypes are for JavaScript. They may vary language to language.
-
what is tuple?
2 years ago
-
What is the difference between null, undefined and 0 in JavaScript?
2 years ago
-
Is no-code practice effective in learning?
2 years ago
-
What are the different Coding Languages?
2 years ago
- 14 Forums
- 1,836 Topics
- 5,052 Posts
- 0 Online
- 1,078 Members