-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f003c29
commit 52e6d35
Showing
5 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/tclsh | ||
|
||
# ! switch_cmd.tcl | ||
|
||
set domain x | ||
switch $domain { | ||
|
||
x { puts "x" } | ||
y { puts "y" } | ||
z { puts "z" } | ||
default { puts "unknown" } | ||
} | ||
|
||
proc power {base p} { | ||
set result 1 | ||
while {$p > 0} { | ||
set result [expr $result * $base] | ||
set p [expr $p - 1] | ||
} | ||
return $result | ||
} | ||
|
||
set a 10 | ||
set b 20 | ||
|
||
if {$a == 10} { | ||
|
||
# ? if expression_1 is true then it will go to expression_2 | ||
if {$b == 20} { | ||
# * if expression_2 is true then it will print the below string | ||
puts "value of a is 10 and b is 20" | ||
} | ||
} | ||
|
||
o/p: value of a is 10 and b is 20 |