Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the output of the last command in an interactive Julia session, like Python's underscore

Tags:

julia

In a command-line Python session, you can use the underscore to grab the output of the previous expression:

> 5 * 6
30
> _ + 2
32

Is there something similar in Julia?

like image 726
Max Avatar asked Oct 31 '25 09:10

Max


1 Answers

You can use ans (https://docs.julialang.org/en/v1/base/base/#ans)

julia> 5 * 6
30

julia> ans + 2
32
like image 140
fredrikekre Avatar answered Nov 04 '25 04:11

fredrikekre