Workspace variable ans
ID | STAT-22 |
Title | Do not use the workspace variable ans . |
Priority | Mandatory |
Severity level | 3 |
Description | Do not use the workspace variable ans since this might lead to undesired behavior. |
Rationale | Use of the workspace variable ans reduces the robustness and security of the code. |
Avoid:
function out = get_value(in)
3 + 3;
out = ans + in;
Instead use:
function out = get_value(in)
var1 = 3 + 3;
out = var1 + in;