basics of Swift 3.0

//integer
var number:Int=8
number+=1
number-=2
number*=2
number/=2

//Double
var accountNumber:Double = 2.55

//string
var name:String = "N"
var lastName:String = "K"

//sample adding
//name+=lastName

//print
print(name)

//combining two string (or) concatination
var fullName:String = "\(name)\(lastName)"

//bool
var bool:Bool = false
var hello:Bool = true

//var vs let
// var is mutable
//let is immutable (constant)

let number1:Int = 10

//type conversion

var myInt:Int = 10
var myDouble:Double = 10.5

// convert int to Double
Double(myInt)+myDouble

//convert Double to Int
myInt +Int(myDouble)
Previous
Next Post »