structInsert() will throw an error if they key already exists, unless you
specify allowoverwrite=true.  I believe structUpdate will throw an error if
the key doesn't already exist, but I'm not 100% sure on that one.

Both of those situations will be more readable (in my opinion) if you do the
check manually to really communicate what you're doing.  The only exception
would be if you needed to do the whole thing in a single _expression_.

Cheers,
barneyb

> -----Original Message-----
> From: Matt Robertson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 14, 2004 5:13 PM
> To: CF-Talk
> Subject: structinsert/structupdate or just set it?
>
> Is there any reason I'd do this:
>
> StructUpdate(Foo,"Bar","WooHoo");
> or this:
> StructInsert(Foo,"Bar","WooHoo");
>
> rather than just doing this?
>
> Foo.Bar="WooHoo";
>
> In both cases I would explicitly state beforehand:
>
> Foo=StructNew();
>
> --
> --Matt Robertson--
> MSB Designs, Inc.
> mysecretbase.com
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to