<commit_before>---
layout: documentation
title: ReactiveX - Last operator
id: last
---

<ol class="breadcrumb">
  <li><a href="{{ site.url }}/documentation/operators.html">Operators</a></li>
  <li><a href="{{ site.url }}/documentation/operators.html#filtering">Filtering</a></li>
  <li class="active">Last</li>
</ol>

   <h1>Last</h1>
   <h3>emit only the last item (or the last item that meets some condition) emitted by an Observable</h3>
   <figure class="rxmarbles-figure">
    <rx-marbles key="last"></rx-marbles>
    <figcaption><p>
     If you are only interested in the last item emitted by an Observable, or the last item that meets some
     criteria, you can filter the Observable with the <span class="operator">Last</span> operator.
    </p><p>
     In some implementations, <code>Last</code> is not implemented as a filtering operator that returns an
     Observable, but as a blocking function that returns a particular item when the source Observable
     terminates. In those implementations, if you instead want a filtering operator, you may have better luck
     with <a href="take.html"><code>TakeLast(1)</code></a>.
    </p></figcaption>
   </figure>

   <h4>See Also</h4>
   <ul>
    <li><a href="elementat.html"><span class="operator">ElementAt</span></a></li>
    <li><a href="first.html"><span class="operator">First</span></a></li>
    <li><a href="take.html"><span class="operator">Take</span></a></li>
    <li><a href="takeLast.html"><span class="operator">TakeLast</span></a></li>
    <li><a href="http://www.introtorx.com/Content/v1.0.10621.0/07_Aggregation.html#Last"><cite>Introduction to Rx</cite>: Last</a></li>
    <li><a href="http://rxmarbles.com/#last">RxMarbles: <code>last</code></a></li>
   </ul>

   <h2>Language-Specific Information:</h2>

<div class="panel-group operators-by-language" id="accordion" role="tablist" aria-multiselectable="true">
  {% lang_operator RxClojure last %}
     <p>
      <span style="color:#ff0000">TBD</span>
     </p>
  {% endlang_operator %}

  {% lang_operator RxCpp last %}
     <p>
      <span style="color:#ff0000">TBD</span>
     </p>
  {% endlang_operator %}

  {% lang_operator RxGroovy last lastOrDefault %}
     <p>
      In RxGroovy, this filtering operator is implemented as <code>last</code> and <code>lastOrDefault</code>.
     </p><p><commit_msg>fix takeLast link 404 on last.html <commit_after>---
layout: documentation
title: ReactiveX - Last operator
id: last
---

<ol class="breadcrumb">
  <li><a href="{{ site.url }}/documentation/operators.html">Operators</a></li>
  <li><a href="{{ site.url }}/documentation/operators.html#filtering">Filtering</a></li>
  <li class="active">Last</li>
</ol>

   <h1>Last</h1>
   <h3>emit only the last item (or the last item that meets some condition) emitted by an Observable</h3>
   <figure class="rxmarbles-figure">
    <rx-marbles key="last"></rx-marbles>
    <figcaption><p>
     If you are only interested in the last item emitted by an Observable, or the last item that meets some
     criteria, you can filter the Observable with the <span class="operator">Last</span> operator.
    </p><p>
     In some implementations, <code>Last</code> is not implemented as a filtering operator that returns an
     Observable, but as a blocking function that returns a particular item when the source Observable
     terminates. In those implementations, if you instead want a filtering operator, you may have better luck
     with <a href="take.html"><code>TakeLast(1)</code></a>.
    </p></figcaption>
   </figure>

   <h4>See Also</h4>
   <ul>
    <li><a href="elementat.html"><span class="operator">ElementAt</span></a></li>
    <li><a href="first.html"><span class="operator">First</span></a></li>
    <li><a href="take.html"><span class="operator">Take</span></a></li>
    <li><a href="takelast.html"><span class="operator">TakeLast</span></a></li>
    <li><a href="http://www.introtorx.com/Content/v1.0.10621.0/07_Aggregation.html#Last"><cite>Introduction to Rx</cite>: Last</a></li>
    <li><a href="http://rxmarbles.com/#last">RxMarbles: <code>last</code></a></li>
   </ul>

   <h2>Language-Specific Information:</h2>

<div class="panel-group operators-by-language" id="accordion" role="tablist" aria-multiselectable="true">
  {% lang_operator RxClojure last %}
     <p>
      <span style="color:#ff0000">TBD</span>
     </p>
  {% endlang_operator %}

  {% lang_operator RxCpp last %}
     <p>
      <span style="color:#ff0000">TBD</span>
     </p>
  {% endlang_operator %}

  {% lang_operator RxGroovy last lastOrDefault %}
     <p>
      In RxGroovy, this filtering operator is implemented as <code>last</code> and <code>lastOrDefault</code>.
     </p><p>
{'fraction_non_alphanumeric': 0.1729948805460751, 'fraction_numerical': 0.012158703071672355, 'mean_word_length': 4.052801724137931, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 187, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '501742', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1507, 'n_words': 389}