Reimplementing the If Statement in Tcl

 #! /usr/bin/tclsh

 # Delete the "if" command
 rename if ""

 # Make our own.
 proc if args {
 	set result [uplevel 1 [list expr [lindex $args 0]]]
 	switch -- $result {
 		"1" {
 			uplevel 1 [lindex $args 1]
 		}
 		default {
 			switch -- [lindex $args 2] {
 				"else" {
 					uplevel 1 [lindex $args 3]
 				}
 			}
 		}
 	}
 }

 # Test it
 if {1} { puts "Test" }
 if {0} { puts "No Test" }
 if {1} { puts "Joe" } else { puts "Bob" }
 if {0} { puts "Joe" } else { puts "Bob" }

 foreach joe [list bob joe sally] {
 	if {$joe == "joe"} {
 		puts "Joe = joe !"
 	} else {
 		puts "Joe = $joe."
 	}
 }