set x 5 puts stdout $x |
JYL@JYLDesktop ~ $tclsh TclTk_0002_001.tcl 5 |
set x 5 set y 10 puts "$x + $y = [expr $x + $y]" |
JYL@JYLDesktop ~ $tclsh TclTk_0002_002.tcl 5 + 10 = 15 |
set x 5 set y 10 puts "$x + $y = [expr $x + $y]" |
JYL@JYLDesktop ~ $tclsh TclTk_0002_002.tcl 5 + 10 = 15 |
set x 5 set y 10 puts {$x + $y = [expr $x + $y]} |
JYL@JYLDesktop ~ $tclsh TclTk_0002_003.tcl $x + $y = [expr $x + $y] |
set x 5 set y 10 puts {$x + $y = [expr $x + $y ] } |
JYL@JYLDesktop ~ $tclsh TclTk_0002_004.tcl $x + $y = [expr $x + $y] |
puts hello ;# here is comment |
JYL@JYLDesktop ~ $tclsh %set pi 3.14 #設定變數 pi 的數值為 3.14 3.14 %set pi #取出變數 pi 的內容 3.14 %set pii #取出變數 pii 的內容,因為並沒有 pii 這個變數,因此會顯示:can't read "pii": no such variable can't read "pii": no such variable % |
if {![info exists counter]} { set counter 0 } else { incr counter ;# counter 加 1 } |
JYL@JYLDesktop ~ $tclsh %info global tcl_rcFileName tcl_version argv argv0 tcl_interactive auto_oldpathauto_path errorCode errorInfo auto_index env tcl_patchLevel argctcl_libPath tcl_platform tcl_library % |
puts "============start of some global variable=============" puts "\$argc=$argc" puts "\$argv0=$argv0" puts "\$argv=$argv" puts "\$tcl_version=$tcl_version" puts "\$tcl_rcFileName=$tcl_rcFileName" puts "\$tcl_interactive=$tcl_interactive" puts "\$auto_path=$auto_path" puts "\$errorCode=$errorCode" puts "\$errorInfo=$errorInfo" puts "\$tcl_patchLevel=$tcl_patchLevel" puts "\$tcl_libPath=$tcl_libPath" puts "\$tcl_library=$tcl_library" puts "============start of some global variable=============" |
JYL@JYLDesktop ~ $tclsh TclTk_0002_0005.tcl ============start of some global variable============= $argc=0 $argv0=ns2_0002_005.tcl $argv= $tcl_version=8.4 $tcl_rcFileName=~/tclshrc.tcl $tcl_interactive=0 $auto_path=C:/cygwin/usr/share/tcl8.4 C:/cygwin/usr/share C:/cygwin/lib $errorCode= $errorInfo= $tcl_patchLevel=8.4.1 $tcl_libPath=C:/cygwin/share/tcl8.4 C:/cygwin/share/tcl8.4C:/cygwin/usr/share/tcl8.4 C:/share/tcl8.4 C:/cygwin/library C:/libraryC:/../tcl8.4.1/library $tcl_library=C:/cygwin/usr/share/tcl8.4 ============start of some global variable============= |
歡迎光臨 SayCoo論壇 (https://family.saycoo.com/) | Powered by Discuz! X3.3 |