You have a stop command - if you're entering the '.' character the program
stops - it doesn't return, so printout is never executed.

Brian C. Monsell
Group Leader, Time Series Research Staff
Statistical Research Division
U. S. Census Bureau

Phone : 301-763-1721
Fax   : 301-763-8399


                                                                           
             Sidney Reilley II                                             
             <sidney.reilley.i                                             
             [email protected]>                                               To 
                                       [email protected]  
             10/29/2009 03:51                                           cc 
             PM                                                            
                                                                   Subject 
                                       [Unicon-group] Procedure in program 
                                       never called                        
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




hey all....

the following code is an excerpt from Corre's publication, "Icon
Programming  for Humanists":

#!/opt/local/bin/icon

global letters
procedure main()
    while word_length(read())
    printout()
end

procedure word_length(line)
local length
initial letters := list(20,0)
if line == "." then stop("Bye")
    line ? while length := (write(*tab(many(&letters)))) do {
       tab(many(' .,;:!'))
       letters[length] +:= 1
       }
    return
end

procedure printout()
local n
    every n:= 1 to 10 do
       write("There are ",letters[n],"",n,"­letter words.")
    return
end

Nothing terribly difficult. I had to "local"ize n and length, and
"global"ize letters, to stop the compiler from squawking.

The program works, but for some reason printout() never gets called.
Can anybody spot why? TIA....
--
Sid

------------------------------------------------------------------------------

Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to