user10794: I have posted questions about "my void loop" or "my void setup" and people complain that they aren't really voids. But they are! See this example code:
void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

Clearly setup and loop are voids because they have the word void right before them!

Note: this is a reference question.

user10794: This is an easy mistake for a beginner to C++ to make. Let's look at other languages, like PHP:
function add ($a, $b)
  {
  return $a + $b;
  }

Or Lua:
function add (a, b)
  return a + b
end

Or JavaScript:
function add (a, b)
  {
  return a + b;
  }

Or VBscript:
Function add (a, b)
  add = a + b
End Function

All those languages have the word "function" there to indicate that you are declaring a function.

So what does C++ look like:
int add (int a, int b)
  {
  return a + b;
  }

So this must be an "int" right? Or what if it doesn't return a value?
void loop ()
  {
  }

Now it's a "void"? Kind of a weird name for a function!
Actually int and void in these examples are not weird names for functions. They are the return types of those functions. int add (int a, int b) is a function that returns an int. And void loop () is a function that returns nothing.
The C++ compiler can deduce when it is seeing a function declaration from some clues:

A return type (eg. int, float, long)
A name (the function name)
Some parentheses (for the function arguments)

Think of the word function as being there in spirit:
int [function] add (int a, int b)
    ^^^^^^^^^^   <-- don't actually type this!
    {
    return a + b;
    }


10794: <p>I have posted questions about "my void loop" or "my void setup" and people complain that they aren't really voids. But they are! See this example code:</p>

<pre><code>void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}
</code></pre>

<p>Clearly <code>setup</code> and <code>loop</code> are voids because they have the word <code>void</code> right before them!</p>

<hr>

<p><em>Note: this is a reference question.</em></p>
 10794: <p>This is an easy mistake for a beginner to C++ to make. Let's look at other languages, like PHP:</p>

<pre class="lang-php prettyprint-override"><code>function add ($a, $b)
  {
  return $a + $b;
  }
</code></pre>

<p>Or Lua:</p>

<pre class="lang-lua prettyprint-override"><code>function add (a, b)
  return a + b
end
</code></pre>

<p>Or JavaScript:</p>

<pre class="lang-js prettyprint-override"><code>function add (a, b)
  {
  return a + b;
  }
</code></pre>

<p>Or VBscript:</p>

<pre class="lang-vbscript prettyprint-override"><code>Function add (a, b)
  add = a + b
End Function
</code></pre>

<p>All those languages have the word "function" there to indicate that you are declaring a function.</p>

<hr>

<p>So what does C++ look like:</p>

<pre class="lang-c++ prettyprint-override"><code>int add (int a, int b)
  {
  return a + b;
  }
</code></pre>

<p>So this must be an "int" right? Or what if it doesn't return a value?</p>

<pre><code>void loop ()
  {
  }
</code></pre>

<p>Now it's a "void"? Kind of a weird name for a function!</p>

<p>Actually <code>int</code> and <code>void</code> in these examples are not weird names for functions. They are the <strong>return types</strong> of those functions. <code>int add (int a, int b)</code> is a <strong>function</strong> that returns an int. And <code>void loop ()</code> is a <strong>function</strong> that returns nothing.</p>

<p>The C++ compiler can deduce when it is seeing a function declaration from some clues:</p>

<ul>
<li>A return type (eg. int, float, long)</li>
<li>A name (the function name)</li>
<li>Some parentheses (for the function arguments)</li>
</ul>

<p>Think of the word <code>function</code> as being there in spirit:</p>

<pre><code>int [function] add (int a, int b)
    ^^^^^^^^^^   &lt;-- don't actually type this!
    {
    return a + b;
    }
</code></pre>
