defer in swift 5 code example
Example: defer swift
defer {
print("This will always be printed last")
}
print("Hello, World!")
// Output:
// Hello, World!
// This will always be printed last
defer {
print("This will always be printed last")
}
print("Hello, World!")
// Output:
// Hello, World!
// This will always be printed last