Ans :
Write a closure that accepts string and return length of string :
Write a closure that accepts string and return length of string :
let simpleClosure:(String) -> (Int) = { name in
return name.count
}
let result = simpleClosure("Hello, World")
print(result)
No comments:
Post a Comment
Thanks