-
Notifications
You must be signed in to change notification settings - Fork 0
/
decl-var.swift
48 lines (27 loc) · 899 Bytes
/
decl-var.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
print("Hello World")
// using var keyword-->
var a = 12
print(a) // yaha rule hai ki jab apan variable me value assign karte hai tab hume pehle and baad me backspace rakhna padhega.
// var b =23--> yaha white space error aaega.
a = 23
print(a)
// 'let' keyword me likhi jaane wali values constant behave karti hai.
let b = 56
print(b)
print("the value of b is: ",b) // hum conactination use kar rahe hai .
// b = 78
//print(b)--> ab yaha error aaya hai kyu ki ab hum b ko koi doosri value assign nahi kar sakte.
// hum value assign kara sakte hai perticular data type ki for example see below:
var c: Int = 79
print(c)
// ab hum alag alag data type me var ki value assign karake print karenge:
var d: Double = 56.789346346346346
print(d)
var e: Float = 34.78235235325
print(e)
var f: String = "Krishna Apple"
print(f)
var g: Character = "A"
print(g)
var h: Bool = true
print(h)