Skip to main content

Tools

The Code step provides the developer with an in-browser code editor equipped with syntax highlighting, intellisense, Code Compare, and Debugging. The Code Compare functionality allows the developer to compare the current (draft) version of the code with the published version (if the app is published). Debugging allows the developer to run the code with some test inputs to see the output values and to debug runtime errors.

Code Compare

Once an app is published, the published version of the code stays unaltered until you publish a newer version which will overwrite the previously published code. The developer can still edit a published app and alter the code, however, the version of the altered code stays in "draft" mode until the developer publishes the new version. Code Compare allows the developer to compare the current "draft" version with the already "published" version of the app.

note

If the app does not have a published version (never published), then Code Compare is not useful.

As an example, consider the published app, Text Spaces Manipulation Function. In the current published version, the code strips the input text of all spaces. The image below shows the change made to the "draft" version of the app's code that doubles the spaces within the text. The version of the code on the right-hand-side is the current "draft" version while the one on the left-hand-side is the published version. The published version will only be replaced if the developer proceeds to Step 6 and clicks on Publish.

img alt

Debugging

The Code step provides the developer with an in-browser code debugger. In addition to viewing error messages and tracebacks, the developer can also view the outputs from print().

As an example, the code below is from the published app Text Spaces Manipulation Function, which uses the print function whose outputs can be viewed in the debugger but will not be visible when the app is used by the user.

def main(inputs):
t = inputs['input_0']
s = t.replace(" ","")
print("Original Text:",t)
print("New Text:",s)
return {"Original Text": t, "Stripped Text":s}

Below is an image of the debugger with the printed output:

img alt