set num [gets stdin] while { $num != 42 } { puts $num; set num [gets stdin] }