Skip to content
Tcl Source Code View Ticket
Login

View Ticket

expr 08 + 1 will error

Closed / Fixed218393ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:57:02
OriginalBugID: 5059 Bug
Version: 1.3
SubmitDate: '2000-04-13'
LastModified: '2000-04-13'
Severity: SER
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Linux
OSVersion: Mandrake 7.0(TclPro1.3 & TCL/TK8.0) & IRIX6.5(TCL/TK 8.0)
Machine: Intel PIII-500 Linux & SGI Origin200
FixedDate: '2000-10-25'
ClosedDate: '2000-04-13'


Name:
Feng Lei

ReproducibleScript:
#!/usr/local/bin/wish

set NUM 1
while {$NUM < 12} {
#  set  NUM [expr $NUM + 1]
   incr NUM
   set  NUM [format "%02d" $NUM]
   puts $NUM
}
exit

ObservedBehavior:
OUTPUT:
02
03
04
05
06
07
08
Error in startup script: expected integer but got "08"
    while executing
"incr NUM"
    (file "String_Format.tcl" line 8)


IF I set the NUM=8 it aslo can not run properly.
09
Error in startup script: syntax error in expression "09 + 1"
    while executing
"expr $NUM + 1"

DesiredBehavior:
It is very easy calculated, but he not understand!



Tcl8.3 explains this error with a better message:

weasel [tcl8.2/unix/sol251] 41 % tclsh8.3
% expr 08
"08" is an invalid octal number

See the docs for more info. 
-- 04/13/2000 hobbs
welch Closed ticket [218393ffff]. [History diff]2000-10-26 08:21:17
dgp Ticket [218393ffff]: 3 changes [History diff]2001-04-18 06:44:59
Log in (anonymous is fine) to add a comment.