The official Tcl website has documentation of features (procedures) that can help you at https://www.tcl.tk/man/tcl/TclCmd/proc.htm .
No argument procedure
If you donβt need any argument, hereβs how to write the desired procedure:
proc funcNameNoArgs {} { puts "Hello from funcNameNoArgs" }
And you can call it like this:
funcNameNoArgs
Argument Procedure
Now let me say that you need arguments in the future. Here's how to write this predicate to TCL:
proc funcNameWithArgs {arg1 arg2 arg3} { puts "Hello from funcNameWithArgs " }
You can call this function by doing:
funcName arg1 arg2 arg3
Here is a code snippet for you!
Remember to define the functions before calling them, or you will receive an error message.
Try copying this code into your interpreter to get started and play with it:
proc funcNameNoArgs {} { puts "Hello from a function with no arguments" } funcNameNoArgs proc funcNameWithArgs {arg1 arg2 arg3} { puts "Hello from a function with 3 arguments" puts $arg1 puts $arg2 puts $arg3 } funcNameWithArgs "Argument 1" "Argument 2" "Argument 3"
oldabl
source share