Skip to content

Check UnusedVariable

github-actions[bot] edited this page Mar 6, 2024 · 2 revisions

If a local variable is declared but not used, it is dead code and should be removed. Doing so will improve maintainability as developers will not wonder what the variable is used for.

Noncompliant Code Example

_method exemplar.hello(name):
    _local message << "Hello " + name  # Unused variable
    print("Hello " + name)
_endmethod

Compliant Solution

_method exemplar.hello(name):
    _local message = "Hello " + name
    print(message)
_endmethod

NOTE: This page is generated. Any changes made to this page through the wiki will be lost in the future.