Would 'byte sendEmail()' be the same as 'void sendEmail()'

I have been looking at some code used in the following example code Arduino Playground - Email and can't find any reference to what is the proper method to be used to document what appears to be a function/subroutine as follows:

byte sendEmail()
{
byte thisByte = 0;
byte respCode;

if(client.connect(server,25) == 1) {
Serial.println(F("connected"));
} else {
Serial.println(F("connection failed"));
return 0;
}

now to me I would usually specify a function / sub-routine by starting off with say 'void sendEmail()'
but when I have tried replacing 'byte' with 'void' it does not compile.

Could someone please explain what the line commencing 'byte...' is really trying to specify ???

I can see that this subroutine is possibly returning a value of '0' or '1' depending on the result of the code running so possibly it is just defining a 'byte' by the name of sendEmail BUT I'd like to see a reference to how it should be used. There is nothing in arduino.cc/reference

Regards all

byte byte sendEmail() tells the compiler that the function will return a byte value when it completes - see the line with return 0.

void byte sendEmail() tells the compiler that the function will not return any value

...R

As simple as that... Thanks

As simple as that... Thanks

No. Robin2's examples have to many bytes in them.

byte someFunction()
{
   return 3;
}

defines a function that returns a byte.

void someOtherFunction()
{
}

defines a function that returns nothing.

The example you post is incorrect in that not all paths actually return a value.