3

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

Jorge Morgado
  • 1,148
  • 7
  • 23
  • I believe you are asking if you can debug Julia code. I know it can be done in vscode with the Julia extension, have you tried that? – Jorge Morgado Oct 04 '20 at 02:44

2 Answers2

3

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/

Nils Gudat
  • 13,222
  • 3
  • 39
  • 60
2

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

Przemyslaw Szufel
  • 40,002
  • 3
  • 32
  • 62