Engee documentation

Breakpoints in scripts

Page in progress.

Breakpoints when working with models are different from those used in scripts.

Breakpoints of script editor interactive script icon allow you to pause code execution in the necessary place to analyse the program and search for errors. This function is available for .ngscript and .jl scripts.

To add a breakpoint to a code cell, hover the cursor over the left corner of a line of code. When a red dot appears, left-click on it to set the breakpoint:

adding breakpoints

To delete, edit or disable a breakpoint, right-click on the red mark and select the desired option:

delete breakpoints in code

A set breakpoint is displayed with a red dot in the left corner of the code line. When it is created, a list of all breakpoints is automatically opened at the bottom of the editor.

adding breakpoints 1

If you right-click on a red breakpoint, a menu for selecting the breakpoint type appears. A total of three types are available:

add breakpoints in code

And three conditions required for breakpoints with conditions:

  • Expression - the breakpoint is triggered only if the specified expression is true.

  • Hit Count - triggers only after a line of code has been executed a certain number of times.

  • Wait for Breakpoint - allows you to pause code execution until another breakpoint is reached.

Let’s consider in detail what breakpoints there are and how they work with conditions:

  • Breakpoint normal breakpoint - This is a basic breakpoint that stops program execution when the code reaches the specified line. This breakpoint does not use conditions.

  • Condition Breakpoint condition breakpoint is a breakpoint with condition. It stops code execution only when the specified condition is met. For example, there is the following code:

    for i in 1:10
        println(i)
    end

    To add a conditional breakpoint, right-click on a line of code, then select Add Conditional Breakpoint. In the menu that appears, enter the condition i==5 in the Expression field and click Enter. The code will now stop when i becomes 5.

    create breakpoint 2 -> create breakpoint 1

  • Triggered Breakpoint condition breakpoint is an extended breakpoint with additional conditions. It stops execution only if another breakpoint has been activated. This is useful for complex debugging when code execution depends on other scripts. For example:

    a = 0.5  # классическая Breakpoint
    b = 1.0  # Triggered Breakpoint, сработает после основной

    To add a breakpoint with additional conditions, right click on a line of code, select Add Triggered Breakpoint. In the menu that appears, select the breakpoint that will trigger before the Triggered Breakpoint and click Ok:

    create breakpoint 5

Changing the conditions will also change the breakpoint type. For example, the Expression and Hit Count conditions are used to create a Condition Breakpoint condition breakpoint, and Wait for Breakpoint for a Triggered Breakpoint condition breakpoint, respectively.

To change the condition, right-click on an already created breakpoint and select the desired option:

editing breakpoints

The system will display a notification when you try to disable breakpoints with conditions or messages:

breakpoint warning 1