REBOL Document

Protect - Function Summary


Summary:

Protect a word or block to prevent from being modified.

Usage:

protect value

Arguments:

value - The word or block of words to be protected (must be: word block)

Description:

Prevents a word from being modified using a set operation. An attempt to modify a locked word generates an error.


    test: "This word is protected!"
    protect 'test
    if error? try [test: "Trying to change test..."] [
        print "Couldn't change test!"
    ]
    Couldn't change test!


    print test
    unprotect 'test
    This word is protected!

Related:

unprotect - Unprotects a word or block of words.


<Back | Index | Next>

Copyright 2004 REBOL Technologies