When you use the `auto` type, the compiler will infer the type automatically from the context of the proc invocation or from the proc body. The inferred types can be different for the different parameters. So you can have a proc declaration that looks like:
proc inferTypes(a, b: auto) # `a` & `b` can accept different argument types
Within a proc, you can also create bindings & variables without needing to specify a type: let iBinding = 1
var fVariable = 1.2
The following typeless code will compile & run without any complaints or problems: import strutils # `%` operator
proc inferTypes(a, b: auto) =
echo "$1 $2" % [$a, $b]
proc main() =
inferTypes(25, 30)
inferTypes(1, "hello")
inferTypes(4.4, 7)
inferTypes("cat", 9.5)
main()
When the above code is compiled & run, it will produce the following output: 25 30
1 hello
4.4 7
cat 9.5