#๏ธdiscardable result

Swift โŸฉ basic types โŸฉ function โŸฉ return value โŸฉ discardable

// โญ๏ธ to silence the compiler from warning

// 1. use @discardableResult at declaration (compile-time)
@discardableResult        
func f() -> Int { ... }

// 2. use _ at call site (run-time)
let _ = g();

Last updated