Swift How to use the default parameter when assigning a function to a variable

import Foundation func test(_ a:Int,b:Int=10)->Int{ return a * b } print(test(2)) //20 //assign func test to a variable var f = test print(f(2)) //error: missing argument for parameter #2 in call 

How to use default parameters when assigning a function to a variable?

+5
source share

Source: https://habr.com/ru/post/1273096/


All Articles