Is there a name for a language feature that allows assignment/creation?

Posted by Alex Mcp on Stack Overflow See other posts from Stack Overflow or by Alex Mcp
Published on 2010-03-30T02:41:56Z Indexed on 2010/03/30 2:43 UTC
Read the original article Hit count: 336

This is a bit hard for me to articulate, but in PHP you can say something like:

$myArray['someindex'] = "my string";

and if there is no index named that, it will create/assign the value, and if there IS an index, it will overwrite the existing value.

Compare this to Javascript where today I had to do checks like so:

if (!myObject[key]) myObject[key] = "value";

I know this may be a bit of a picky point, but is there a name for the ability of PHP (and many other languages) to do these checks on their own as opposed to the more verbose (read: PITA) method of Javascript?

© Stack Overflow or respective owner

Related posts about language-features

Related posts about JavaScript