Re: Why Does Child Window Disappear?

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Wed, 22 Jan 2003 11:58:01 -0800 (PST), cafromsw at yahoo.com wrote:

>I do have one question though, why is the variable t
>in sequence brackets {} in setText when it seems to
>works fine without them?
>setText( LText2, sprintf("This is message#%d",{t}) )
>setText( LText2, sprintf("This is message#%d",t) )

Convention: while sprintf("text %d", 2) and sprintf("text %d",{2})
will both produce "text 2", if you code sprintf("text %s","test") and
sprintf("text %s",{"test"}), then (as documented in the euphoria
reference manual) the first will unexpectedly produce "text t",
whereas the second (the more likely wanted) "text test".

Also, if your format string has more than one '%d' or '%s' etc, you
need to use the {} to pass the fields as one parameter.

Since you often need the {}, and sometimes omitting them gives the
wrong answer, it is easiest just to always get used to using them.

Like everything else, easy once you get used to it.

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu