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

相关文章
相关标签/搜索