# Accessing \`ans\` by pressing the \`\[DOWN\]\` key

**URL:** <https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797>\
**Category:** Internals & Design\
**Tags:** repl, suggestions\
**Created:** [November 6, 2019, 2:39pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797 "2019-11-06T14:39:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [November 6, 2019, 2:39pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/1 "2019-11-06T14:39:59Z")

</div>

The title explains itself.

Wouldn’t be great, in the REPL, to be able to access `ans` by pressing the `[DOWN]` key (or any other better one) once the history has finished? IMHO Yes, it would.

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [November 6, 2019, 4:23pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/2 "2019-11-06T16:23:30Z")

</div>

That would save two key strokes and your fingers have to leave the home position. So it’s slower. Maybe I’m missing something. Is typing `ans` a pain point for you ?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [November 7, 2019, 6:04pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/3 "2019-11-07T18:04:11Z")

</div>

I like it! Would be a pretty easy PR, I suspect.

---

<div class="post-metadata">

**Author:** ![Balinus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/balinus/32/243_2.png) [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Post date:** [November 7, 2019, 7:33pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/4 "2019-11-07T19:33:25Z")

</div>

> [@jlapeyre](#):
>
> your fingers have to leave the home position.

It all depends on your definition of the home position I guess! Mine’s is over the “enter” key and arrow-key when I just finished evaluating a statement.

---

<div class="post-metadata">

**Author:** ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Post date:** [November 8, 2019, 5:06am UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/5 "2019-11-08T05:06:36Z")

</div>

Yes, I guess it varies widely.

---

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [November 10, 2019, 8:08am UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/6 "2019-11-10T08:08:01Z")

</div>

I often use Julia’s REPL as a calculator. I have the enter key, the arrows, and the numbers, and some basic operations such as `/`, `*`, `+` and `-`, next to each other, all of them accessible from my right hand.

---

<div class="post-metadata">

**Author:** ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Post date:** [November 10, 2019, 3:03pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/7 "2019-11-10T15:03:01Z")

</div>

How would this proposal alter the current configuration for browsing through the history of commands?

---

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [November 10, 2019, 3:19pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/8 "2019-11-10T15:19:00Z")

</div>

I would say, insert `ans` only if currently at the last history entry and its empty. So this doesn’t really affect history browsing. In other words, when “down key” is pressed, try first to “go down” in history, if this fails and if current entry is empty, insert `ans`.

---

<div class="post-metadata">

**Author:** ![fipelle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fipelle/32/4772_2.png) [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Post date:** [November 10, 2019, 3:27pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/9 "2019-11-10T15:27:29Z")

</div>

I agree. Otherwise you might want to use a different key to get `ans` in the REPL (left arrow?).

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [November 10, 2019, 4:20pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/10 "2019-11-10T16:20:57Z")

</div>

how do you navigate the line of code if you use left arrow for `ans`…

---

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [November 10, 2019, 4:52pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/11 "2019-11-10T16:52:17Z")

</div>

> [@jling](#):
>
> how do you navigate the line of code if you use left arrow for `ans` …

I think this could also work, insert `ans` only if the current entry is empty, otherwise navigate as usual.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [November 10, 2019, 4:53pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/12 "2019-11-10T16:53:54Z")

</div>

but if we’re already talking about ‘current line is empty’, why not just down?

---

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [November 10, 2019, 5:00pm UTC](https://discourse.julialang.org/t/accessing-ans-by-pressing-the-down-key/30797/13 "2019-11-10T17:00:29Z")

</div>

Sure, why not just down, might be more natural, just wanted to say that both options are probably available.
