class PowerOfTwo {
subscript(i: Int) -> Int {
return Int(pow(Double(2), Double(i)))
}
}
let power2 = PowerOfTwo()
let p2 = power2[2]
//p2 is 4
let p8 = power2[8]
//p8 is 256
let p16 = power2[16]
//p16 is 65536
print("p2 is \(p2)")
print("p8 is \(p8)")
print("p16 is \(p16)")