Kisi bhi program me hume data ki zarurat padti hai.
Jese ki:
- Calculator program me user ka expression.
- Game me user ka state aur action store karna.
- Website me user ka submit kiya hua form data.
Aadi!
Memory kya hai?
Hamare computer me 2 jagah par data ko rakhte hain:
- Memory (RAM)
- Storage (Hard-Disk)
Memory
Ye RAM ke andar ki jagah hai, jise computer ek program ko run karne aur us program ke data ko rakhne ke liye istemal karta hai.
Jab hum computer ko off karte hain, to RAM ke andar ki ye jagah saaf ho jaati hai.
Storage
Hard disk ya koi bhi aur storage device data ko hamesha ke liye sambhal kar rakhne ke liye use karte hain.
Isme program ko chalane ke baad uska output ya data store karte hain. Jaise, humne koi file edit ki aur save ki, to computer use RAM se copy karke storage me store karta hai.
Computer band hone ke baad bhi ye data rahega.
Data Types kya hain aur kyu hain?
Maan lo aapke kitchen me ek transparent bottle rakhi hui hai, jisme orange color ka liquid hai.
Bina jaane ki woh liquid kya hai, kya aap use juice samajh kar piyenge?
Woh floor cleaner ka liquid bhi ho sakta hai, hai na?
Koi bhi pehle yahi sochega ki bottle me kya hai.
Ye confusion na ho, isliye juice ki apni ek bottle hoti hai, label ke saath, aur uski ek alag jagah hoti hai fridge me.
Aur floor cleaner ki bhi.
Liquid ka color same hai aur quantity bhi same hai, isliye agar hum kisi bhi bottle me daalenge, to gadbad hogi.
Usi tarah, computer ko data dene par use pata hona chahiye ki data kitna hai aur kis type ka hai, taaki woh use RAM me sahi tarike se store kar sake aur us par sahi operations kar sake.
Maan lo humne ek string di, "hello world!", aur ek number diya, 4, aur kaha ki dono ko mila do.
Ab computer bechara kya karega?
Agar use pata hai ki ye number hai, to woh number ke saath number ko milayega aur string ko string ke saath.
Warna, bina bataye number aur string ko milane doge, to data corrupt ho sakta hai.
Isliye har data ka ek type hota hai, aur us type ko hum apne program me pehle hi batate hain ki ye kis type ka data hai. Is par kaun-se operations kar sakte hain aur kaun-se nahi.
Go me Data-Types
1. Basic Types
Boolean
| Type | Description |
|---|---|
bool |
Boolean value (true or false) |
Integer Types
| Type | Size | Description |
|---|---|---|
int8 |
8-bit | Signed integer |
int16 |
16-bit | Signed integer |
int32 |
32-bit | Signed integer |
int64 |
64-bit | Signed integer |
int |
32/64-bit | Platform-dependent signed integer |
uint8 |
8-bit | Unsigned integer |
uint16 |
16-bit | Unsigned integer |
uint32 |
32-bit | Unsigned integer |
uint64 |
64-bit | Unsigned integer |
uint |
32/64-bit | Platform-dependent unsigned integer |
uintptr |
32/64-bit | Integer capable of holding a pointer value |
Floating-Point Types
| Type | Size | Description |
|---|---|---|
float32 |
32-bit | Single-precision floating point |
float64 |
64-bit | Double-precision floating point |
Complex Types
| Type | Size | Description |
|---|---|---|
complex64 |
64-bit | Complex number |
complex128 |
128-bit | Complex number |
Other Basic Types
| Type | Description |
|---|---|
byte |
Alias for uint8
|
rune |
Alias for int32
|
string |
Immutable sequence of bytes |
2. Composite Types
| Type | Description |
|---|---|
| Array | Fixed-length collection of elements |
| Slice | Dynamically sized collection |
| Struct | Collection of fields |
| Map | Key-value data structure |
| Pointer | Stores a memory address |
| Function | Function value |
| Channel | Communication between goroutines |
3. Interface Types
| Type | Description |
|---|---|
interface |
Defines a set of methods |
any |
Alias for interface{}
|
error |
Built-in error-handling interface |
4. Type Constraints (Generics)
| Type | Description |
|---|---|
comparable |
Restricts types to those supporting == and !=
|
~T |
Matches types with underlying type T
|
Ye sab dekh kar darna mat. Ye bas saamanya gyaan ke liye hai. Baaki, hum series me aage ek-ek karke saari zaroori cheezein seekhenge.
Abhi ke liye bas itna hi!
मैंने भगवान पर एक छोटी-सी शायरी लिखी है।


Top comments (9)
I don't know hindi :(
No worries!
I am a non-native hindi speaker. I like the language a lot, so this series helps me learn the language more!
Thank you so much for the support! 😊🙌
What? Then what language do you speak? I speak Malayalam! What do you speak?
Telugu
Telugu 😃
yep!
🥰
Thank you 😊
Your welcome 🥰😃🤝😀