Arithmetic/Integer: Difference between revisions

m
m (→‎{{header|Tcl}}: comment about using braces in expr command)
Line 616:
 
=={{header|Tcl}}==
<lang tcl> puts "Please enter two numbers:"
 
puts "Please enter two numbers:"
gets stdin x
Line 628 ⟶ 627:
$x / $y = [expr {int($x / $y)}]
$x mod $y = [expr {$x % $y}]
"</lang>
 
Since Tcl doesn't really know about the "type" of a variable, the "<tt>expr</tt>" command is used to declare whatever follows as an "expression". This means there is no such thing as "integer arithmetic" and hence the kludge <tt>int( $x / $y )</tt>.
Anonymous user