Go to main content

deletectx

Delete an entry in a context.

DELETECTX

NAME

deletectx - Deletes an entry in a context.

SYNOPSIS

deletectx (variable, key…); deletectx (ctx:variable, key:key);

DESCRIPTION

This function is used to delete an entry in a context based on a key.

PARAMETERS

ctx
Specifies the context
key
Specifies the key

RETURN

Nothing.

EXAMPLES

// Simple usage
a = {x:1,y:2,z:3,w:[4,5]}; 
deletectx(a,'w'); 
a;
// {"x":1,"y":2,"z":3}

// Alternate syntax
my_ctx = {"name": "Paul", "profession": "Prophet"};
my_ctx.deletectx("profession");
my_ctx;
// {"name":"Paul"}

// Delete multiple keys
a = {x:1,y:2,z:3,w:[4,5]}; 
deletectx(a,'w', 'x'); 
a; 
// {"y":2,"z":3}

// Alternate syntax
a = {x:1,y:2,z:3,w:[4,5]}; 
deletectx(ctx:a,'w', key:'x'); 
a; 
// {"y":2,"z":3}

// Not a context
a = 1; 
deletectx(ctx:a,'w', key:'x'); 
a;
// is not a context.

SEE ALSO

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.