Tcl命令操做實驗-----(5)---switch和proc

Vivado% proc myproc {arg} {
puts $arg
}
Vivado% myproc myname
myname

Vivado% if {2>1} {
puts 2>1
} else {
puts 2<1
}
2>1

Vivado% set grade c
c
Vivado% switch $grade A {puts "well done"} B {puts "excellent"} C {puts "good"}
Vivado% switch $grade {A {puts "well done"} B {puts "excellent"} C {puts "good"} }
Vivado% switch 2 {
1 {puts 111}
2 {puts 222}
3 {puts 333}
default {puts xxx}
}
222

爲何spa

Vivado% switch $grade A {puts "well done"} B {puts "excellent"} C {puts "good"}
Vivado% switch $grade {A {puts "well done"} B {puts "excellent"} C {puts "good"} }

上面兩句代碼沒有顯示呢?反而看switch 2這樣的代碼卻有顯示?不明白。

原來是set grade c這一句代碼中的c要大寫纔能有顯示excel

相關文章
相關標籤/搜索