title: return statement in ternary operator c++
body: <p>I wrote the absolute function using ternary operator as follows</p>
  
  <pre><code>int abs(int a) {
   a &gt;=0 ? return a : return -a;
  }
  </code></pre>
  
  <p>I get the following error messages</p>
  
  <pre><code>../src/templates.cpp: In function ‘int abs(int)’:
  ../src/templates.cpp:4: error: expected primary-expression before ‘return’
  ../src/templates.cpp:4: error: expected ‘:’ before ‘return’
  ../src/templates.cpp:4: error: expected primary-expression before ‘return’
  ../src/templates.cpp:4: error: expected ‘;’ before ‘return’
  ../src/templates.cpp:4: error: expected primary-expression before ‘:’ token
  ../src/templates.cpp:4: error: expected ‘;’ before ‘:’ token
  ../src/templates.cpp:5: warning: no return statement in function returning non-void
  </code></pre>
  
  <p>If I write like this </p>
  
  <pre><code>return a&gt;=0 ? a : -a;
  </code></pre>
  
  <p>I don't get any error.
  What's the difference between the two?</p>