Skip to content

PI is not defined before setup()! #903

@golanlevin

Description

@golanlevin

An error occurs when a variable with global scope is initialized to PI or TWO_PI.
It appears that PI does not work as a constant until after setup is called.
The error is: Uncaught ReferenceError: PI is not defined

Here's a working program that produces the error:

var halfCircle = PI;
function setup() {
  createCanvas (100,100);
}

Interestingly, this error will allow the app to run when launched from a local file, but NOT when it is run from a server (e.g. when embedded in Wordpress).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions