Answers for "Tcl Conditional and Logical operators"

0

Tcl Conditional and Logical operators

# Conditional/Logical Operators in Tool Command Language (Tcl)
# ============================================================
# Equal to: "=="
set x 101;
if {$x == 101} {
	puts "x = 101";
}
# Not Equal to: "!="
if {$x != 100} {
	puts "x is NOT equal to 100";
}
# Conditional OR: "||"
if {$x == 101 || $x == 22} {
	puts "Either x = 101 OR 22";
}
# Conditional AND: "&&"
if {$x == 101 && [expr $x - 1] == 100} {
	puts "x=101 AND x-1 = 100";
}
Posted by: Guest on October-29-2020

Code answers related to "Tcl Conditional and Logical operators"

Browse Popular Code Answers by Language