A+B: Difference between revisions

165 bytes added ,  14 years ago
→‎{{header|Tcl}}: Do it with files!
(→‎{{header|Tcl}}: Added a one-liner; less clear IMO but still neat)
(→‎{{header|Tcl}}: Do it with files!)
Line 212:
Alternatively:
<lang tcl>puts [tcl::mathop::+ {*}[gets stdin]]</lang>
To/from a file:
<lang tcl>set in [open "input.txt"]
set out [open "output.txt" w]
scan [gets $in] "%d %d" x y
puts $out [expr {$x + $y}]
close $in
close $out</lang>
Anonymous user