> From: Sprague, Webb (OFM)
> 
> I have a question about printf.  The following example from the docs
> works just fine:
> 
> 'The population of %s is %d\n' printf 'Raleigh';240000
> 
> However, when I try to modify it as the following, it doesn't work:
> 
> 'The population of %s\n' printf 'Raleigh'
> |length error: exeformat
> 
> Could someone explain this to me?

printf will insert items of the right argument in the left argument where 
specified.
So:
   'The population of %s\n' printf 'R'
The population of R
However 'Ralegih' is not one item, but a list of 7. You need to box it to make 
it a single item:
   'The population of %s\n' printf <'Raleigh'
The population of Raleigh

When starting a new thread, please don't reply to a message from a previous 
thread - even if you change the subject it isn't recognized as a new thread. 
Start a new message instead.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to