Tcl

Tcl:   Tool   Command   Language
==========================

Substitutions
$  - Variable Substitution
          Used to substitute the value of a variable
          Eg:    set a 7
                   puts  a                            Output:  a
                   puts  $a                          Output:  7
 
[] – Command Substitution
          Used to substitute expression inside of the brackets
          Eg:    set a 7
                   puts  [expr $a+3]            Output:  10
                   puts  [expr 3 * 5 ]           Output:  15
                   set  c   [expr 2*4] 
                   puts c                             Output: 8
 
\ - Backslash Substitution
          Used to substitute special characters



Comments
Single Line Comment
Single line will be commented by #
Eg:    # This is single line comment

Multiple Lines Comment
Multiple lines will be commented by if with condition 0
Eg:    If 0 {
Comment statement1
Comment statement2
         …………
Comment statementN
                          }


String Representations
When we want to represent multiple strings, we can use either double quotes or curly braces.
Eg:    set str1 “Welcome to Tcl Script”
          puts $str1                                          Output:  Welcome to Tcl Script
          set str2 {Welcome to Tcl Script}
          puts $str2                                          Output:  Welcome to Tcl Script
 

No comments:

Post a Comment