# PDE - Code Editor

### Event-based Programming - Repeated Execution

### Global Variables:

* Variables declared at the top of the script
* variables declared outside of any function have global scope
* Global Variables should be initialized in the setup function
* Animation Variables - a variable's value gets re-initialized each frame if it is declared inside draw( )

### Initialization: Setup is executed one time

`void setup( ) {   //code   }`   \
&#x20;**Processing event function - for initialization - auto-executed once**

### Draw Loop

`void draw( ){  //code }`    \
&#x20;**Processing event function - auto-executed: event looping: 60 frames/second**

### Static vs Active Mode

**static vs. active mode -** all code, other than global variable declaration/ initialization must be within functions.\
**Do not have any code outside of a function definition**

### Debugging:

**`println( “label “ + value)`** \
shows in the console when the program is executing\
helpful for debugging

**Comment syntax**:  Use for labeling and debugging\
`// single line comment`\
`/*  multi`\
`line comment */`&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kdoore.gitbook.io/cs1335/getting-started/pde-code-editor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
