RosettaCodeData/Task/Increment-a-numerical-string/Tcl/increment-a-numerical-string-1.tcl
2026-04-30 12:34:36 -04:00

12 lines
281 B
Tcl

# n is string
set n "1234"
# increments the integer rep to 1235, updates string rep to "1235"
incr n
# integer rep added to n
# o is calculated integer
set val [expr {$n + 1}]
# n is string,
# o used as string adds string representation to o
puts stdout "$n incrememented is $o"