title: Rxjs iif or simple if
body: <p>I have the following code:</p>
  
  <pre><code>obs.pipe(
     switchMap((val) =&gt; {
         // some logic...
         return iif(() =&gt; condition, someObservable())
     })
  );
  </code></pre>
  
  <p>I am just wondering why couldnt this have been achieved with a simple <code>if</code> instead of the <code>iif</code>? </p>
  
  <pre><code> if (condition) {
      return someObservable();
   }
  </code></pre>