title: VBA function returns a value although return value is not defined
body: <p>I found this function which VBA IDE compiles fine when I click on the <em>&quot;Debug / Compile VBAProject&quot;</em>:</p>
  <pre><code>Public Function getArrayLength(ByRef myArray)
      If (IsEmpty(myArray)) Then
          getArrayLength = 0
      Else
          getArrayLength = UBound(myArray) - LBound(myArray) + 1
      End If
  End Function
  </code></pre>
  <p>It has no <em>&quot;return type&quot;</em> defined and no <em>&quot;parameter type&quot;</em> defined.</p>
  <p>I already found from the official reference (<a href="https://docs.microsoft.com/en-us/office/vba/language/glossary/vbe-glossary#variant-data-type" rel="nofollow noreferrer">link</a>) that <code>myArray</code> is assigned type <code>Variant</code> if we don't explicitly assign any type to it.</p>
  <p>But what happens with the <em>&quot;return type&quot;</em>? In this case project compiles so something is returned. But what?</p>