How to debug Julia code in Atom using Juno?

1k views Asked by At

If yes, would I be able to check the values of the variables then? I am using Juno in atom.

2

There are 2 answers

0
Nils Gudat On

Yes, there are a number of different debugging options available for Julia that allow you to set breakpoints, step into code, and inspect values of variables. If you're using Juno, you can check the Juno Debugging documentation here: http://docs.junolab.org/stable/man/debugging/

0
Przemyslaw Szufel On

Regardless of IDE you can also debug using Debugger.jl.

Consider this code (from Debugger.jl README):

using Debugger

function foo(n)
    x = n+1
    ((BigInt[1 1; 1 0])^x)[2,1]
end

Now you can debug this code using @enter macro in the following way:

julia> @enter foo(20)
In foo(n) at REPL[9]:1
 1  function foo(n)
>2      x = n+1
 3      ((BigInt[1 1; 1 0])^x)[2,1]
 4  end

About to run: (+)(20, 1)
1|debug>

Pressing n key will move the execution to the next line and all other standard debugging options are available - for the details see https://github.com/JuliaDebug/Debugger.jl