---
title: "Including print statements in programmable decisions"
slug: "including-print-statements-in-programmable-decisions"
abstract: "Using print statements in programmable decisions in Sitecore Personalize aids in debugging by revealing code execution flow and error points."
---
# Including print statements in programmable decisions

It's best practice to include  `print()` statements in programmable decisions because they can help in debugging and understanding the flow of execution. These `print()` statements let you view the programmable output on the **Logs** tab, up until the point the code throws an error. This makes it easier for you to check the programmable functions that are working as expected and identify specific segments of the code that are causing errors when you [test the decision model variant](https://doc.sitecore.com/personalize/en/users/sitecore-personalize/introduction-to-decisioning-in-sitecore-personalize/managing-decision-model-variants-in-sitecore-personalize/test-a-decision-model-variant.html "Test a decision model variant").

The following image shows an example of adding three `print()` statements for the guest's `gender`, `city`, and `guestType` to test a programmable.

![Adding print statements in a programmable component to print guest data.](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/print_statement.png)

On the **Test Canvas**, on the **Logs** tab, you'll see the programmable test results, where the output for the guest's `gender`, `city`, and `guestType` are printed.

![Displaying print statement results in the Logs tab.](https://doc.sitecore.com/api/markdown-image/personalize/en/users/sitecore-personalize/images/Logs_tab_print.png)

For enhanced debugging, you can also print entire JavaScript objects using the `print(JSON.stringify(example));` statement. This outputs the object in a readable, formatted JSON structure with line breaks and indentation.