Search waiting | Matsusada Precision

Searching...

Technical Terms

The Return value is the value that a function or subroutine sends back to the part of the program that called it after it has completed its execution. When a function is called, it performs its task and, upon completion, it "returns" a result. This result is the return value. Not all functions have a return value; some functions, called procedures or subroutines in some languages, simply perform an action and do not return anything (this is often indicated by a void return type). In instrument control programming, return values are crucial for getting feedback from the device.

For example, a function designed to set the output voltage of a power supply, SetVoltage(5.0), might not have a useful return value (it might just return a status code indicating success). However, a query function, which asks the instrument for information, relies entirely on its return value. A function like MeasureCurrent() would be called, and its return value would be a floating-point number representing the current in amps that the power supply measured. The main program would store this return value in a variable and then use it for logging, analysis, or further decision-making in the test sequence. Understanding what type of data a function returns (e.g., an integer, a string, a boolean) is essential for using it correctly.

Information on related articles in Technical Knowledge