---
title: "Debug"
canonical: "https://docs.cuesystem.com/space/CVCHELP/512327681/Debug"
format: markdown
---
> Macro (toc)

---

# DebugPrint 

This function prints debug statements into a debug window of a connected IDE. Printed debug statements (ParamArray) are formatted using the default format text. More DebugPrint functions with one parameter are equivalent to one DebugPrint function with more parameters. 

#### Syntax 

```visualbasic
Function DebugPrint(ParamArray)
```

#### Parameters 

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed debug statements. 

#### Example 

```visualbasic
Var i As Long := 123 
Var t1 As Text[100] := "Hello, how are you?" 
Var t2 As Text[100] := "I am fine." 

DebugPrint(i) 
DebugPrint(t1) 
DebugPrint(t2) 

// previous DebugPrint functions are equivalent to 
DebugPrint(i, t1, t2)
```

It prints to the debug window: 

```visualbasic
123 
Hello, how are you? 
I am fine.
```

# DebugPrintFormat 

This function prints debug statements into a debug window of a connected IDE. Printed debug statements (ParamArray) are formatted using <u>[formatting rules formattext](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281)</u>. 

The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number that occurred while executing the command. The errors that can happen: <u>[2](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#2)</u>, <u>[3](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#3)</u>, <u>[4](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#4)</u>, <u>[5](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#5)</u>, <u>[6](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#6)</u>, <u>[7](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#7)</u>, <u>[8](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#8)</u>, <u>[9](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#9)</u>, <u>[10](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10)</u>, <u>[11](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#11)</u>, <u>[12](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#12)</u>, <u>[13](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#13)</u>, <u>[14](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#14)</u>, <u>[15](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#15)</u>, <u>[25](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#25)</u>, <u>[26](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#26)</u>, <u>[27](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#27)</u>. 

#### Syntax 

```visualbasic
Function DebugPrintFormat(  
  formattext As Text, 
  ParamArray)
```

#### Parameters 

formattext 

<u>[Text](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> It is the format text, which sets rules on the format, which will be applied to the variable parameters. See the [https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/518881281).

ParamArray 

<u>[ParamArray](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/509149361)</u> They are the printed debug statements. 

# IsDebugEnable 

This function returns true if the logging of debug statements in the IDE environment is enabled, false otherwise. 

#### Syntax 

```visualbasic
Function IsDebugEnable() As Boolean
```

#### Return value 

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> It is True if the logging is enabled, False otherwise. 

#### Example 

```visualbasic
If IsDebugEnable() Then 
  // this code is executed only if debug is enabled 
  // so only the debug code can be used here 
End If
```

#### Example 

```visualbasic
Const MAXIMUM As Long := 10 

Private Process Autoexec() 
  Var a[MAXIMUM] As Long 
  Var i As Long 
 
  // fill array 
  For i := 1 To MAXIMUM 
    a[i] := i * i 
  End For 

  // the followed code is executed only if debug is enabled 
  If IsDebugEnable() Then 
   For i := 1 To MAXIMUM 
      DebugPrintFormat("a[{n}] = {n}", i, a[i]) 
   End For 
  End If 
End Process
```

It prints to the debug window (if a debug is enabled): 

```visualbasic
a[1] = 1 
a[2] = 4 
a[3] = 9 
a[4] = 16 
a[5] = 25 
a[6] = 36 
a[7] = 49 
a[8] = 64 
a[9] = 81 
a[10] = 100
```