Thursday, 27 August 2015

Tool Command Language - lecture 7 - Functions

The syntax of function or procedure in tcl is as
                
proc function_name { arguments } {
             body 
             return 
    } 
    Example
 proc add { a b } {
 return [expr $a + $b ]
  }
 set c [add 3 2 ]

 out put  5
 Here we have declared a function or most appropriate a  procedure  named as add, with arguments as a,b. Later we set a variable c and  we call the above function with two arguments. In return we obtain  sum of  these two arguments and that is assigned to c . 



No comments:

Post a Comment

Grammar Mistakes in Technical Paper Writing

Let me share some experience in this post with you. I'm currently in the second year of my Ph.D. program. We are in the middle of paper...