Last modified on 27 October 2012, at 22:19

REBOL Programming/alter

USAGE:Edit

ALTER series value /case 

DESCRIPTION:Edit

If a value is not found in a series, append it; otherwise, remove it. Returns true if added. (Modifies)

ALTER is a function value.

ARGUMENTSEdit

  • series -- (Type: series port)
  • value -- (Type: any)

REFINEMENTSEdit

  • /case -- Case-sensitive comparison

SOURCE CODEEdit

alter: func [
    {If a value is not found in a series, append it; otherwise, remove it. Returns true if added. (Modifies)} 
    series [series! port!] 
    value 
    /case "Case-sensitive comparison"
][
    found? unless remove (
        either case [find/case series :value] [find series :value]
    ) [append series :value]
]