Wiki
Version 2 (modified by todd.a, 14 years ago)

--

Pass

Do nothing successfully.

Used as a placeholder or for null operation where code is expected (like in a block) but nothing needs to be done.

Grammar

pass

Examples

def methodNeededForInterface # but not used
    pass

# simplify complicated code flow.
if .complicatedExpression0
    if .expression1 and .expression2 and not .expression3 or expression4 
        pass # all is well
    else if expression1 and not expression2
        .expressFailure
    else if .expression3
        .expressFailure2
    # ...


# property with both getter and setter, setter must be available but does nothing
pro isUsed as bool
    get
    return false
    set
    pass

try
   .doOperation
catch FormatException
   pass    # trap and discard the exception

Notes