#126: tcl function with default arguments

proc add {a {b 5}} {
    return [expr $a+$b]
}
puts [add 10 12]
puts [add 12]

Output:

22
17

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading