Skip to main content

How to check the return value of a function in a PRACTICE script? - Knowledgebase / PRACTICE - Lauterbach Support

How to check the return value of a function in a PRACTICE script?

Every function has usually a pseudo-variable called return. You can see that in the window sYmbol.Browse.Var \\*\*\< myfunc >\* (where < myfunc > is the name of your function).

You can get the value of any variable using the PRACTICE function Var.VALUE(< variable >).

So, you get the return value of function myfunc() with

GO sYmbol.EXIT(myfunc) // go to return statement of myfunc

PRINT Var.VALUE(return) // get the return value


In case you would like to do a module test, then you can use the Var.set command and Var.VALUE(< varname >) PRACTICE function.

Example: to call the function int func3(int a, int b) with random arguments (e.g. 5 and 3) and get the return value, do the following:

Var.NEWLOCAL \x // create artificial variable on the PRACTICE stack
Var.set \x=func3(5,3) // execute func3() with arguments 5 and 3 on your CPU
PRINT Var.VALUE(\x) // get the return value



Helpful Unhelpful

2 of 2 people found this page helpful

Add a comment

ID-0
To prove you are a human, please tell us the text you see in the CAPTCHA image