Ejemplo: operadores lógicos y condicionales de Tcl
# 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";
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)