Omitting return value from functions?

Hi!

If I make a function let’s say: boolean setSomeValues(int mode);
Then I could use the returned value from the function to check if the operation went OK.
But sometimes I just want to call the function and not check the result.
Is it good practice to omit the returned result?
i.e
setSomeValues(mode);
instead of
Ok = setSomeValues(mode);

That is entirely up to you to decide. The compiler will not care. The Arduino will not care. It is fairly common to ignore a return value so most people on this side of your monitor will not care.

Is it good practice to omit the returned result?
i.e
setSomeValues(mode);
instead of
Ok = setSomeValues(mode);

There is not much point in having a function that returns a value and then not using it. On the other hand if you don't need a returned value then why bother returning one ?

This is what the void datatype is for. eg. void setup(), void loop().

void means there there is no return value so you should use : void setSomeValues(int mode)

UKHeliBob:
There is not much point in having a function that returns a value and then not using it. On the other hand if you don't need a returned value then why bother returning one ?

Many C programmers have been writingprintf("Hello world\n"); for what seems like centuries. If you want make your intentions clear, write

(void)printf("Hello world\n");

What about serial.print()? It returns the number of characters printed. I guess that might be useful for some kinds of formatting. But seldom used.

If it isn't good practice, how could it be made so?