SA0009: Unused return valuesPermalink

Detects function, method and property calls in which the return value is not used

Justification: When a function or method returns a return value, it should also be evaluated. The return value often indicates whether or not the function was executed successfully. If not, then you will not be able to identify later whether the return value was forgotten or if it is actually not needed.

Exception: If a return value is irrelevant to the call, then you can document this and omit the assignment. Error returns should never be ignored.

Importance: Medium

PLCopen rule: CP7 / CP17

Example

FUNCTION Return_BOOL : BOOL
VAR_INPUT
END_VAR
VAR
	xTest : BOOL;
END_VAR
xTest := FALSE;
Return_BOOL := xTest;

PROGRAM PLC_PRG

Return_BOOL ();  // SA0009 

--> SA0009: Ignoring return value of 'Return_Bool'