The Runnable Code Snippets feature allows instructors and students to compile and run code in published posts.


To configure this feature, first go to Manage Class and navigate to the Customize Q&A section. 


Choose "Enable" to allow runnable code snippets, or choose "Disable" to turn this option off. 

As an instructor, you can also choose a default programming language for code snippets. The code widget will open with this language selected for compilation and syntax highlighting purposes. This feature currently supports the following languages: Bash, C, C#, C++, Java, JavaScript, Kotlin, PHP, Perl, Python, Ruby, Swift, and VB.NET.


While this feature is enabled, code blocks in published posts will include a "run code snippet" button below the block:


This button opens a widget in which students and instructors can make minor changes to the code and run it to view the output:

(Please note that edits made in this widget are not saved to the post.)


After clicking "Run" in the bottom right, the code will run, displaying any output or errors in the "output" tab.

Users may also select a different language (if needed) in the bottom right.

If you have any feedback or questions regarding this feature, please let us know at team@piazza.com.