Skip to content

Refine the syntax section of the reference #384

@nickmcintyre

Description

@nickmcintyre

The syntax section of the reference could be clearer in a few places.

Methods

The reference pages for methods such as p5.Vector.add() display the following syntax:

add(x, [y], [z])

add(value)

add(v1, v2, [target])

It'd be helpful to demonstrate the dot operator, and to distinguish between instance and static methods. I suggest standardizing on p5.X.method() and myX.method(), as in:

myVector.add(x, [y], [z]);

myVector.add(value);

p5.Vector.add(v1, v2, [target]);

Side note: I'm not sure whether we should encourage copy/pasting syntax snippets.

Events and Structure

The reference pages for event functions such as doubleClicked() display the following syntax:

doubleClicked([event])

It'd be helpful to demonstrate that these functions are declared, not called, as in:

function doubleClicked([event]) {
  // Code to run.
}

🤦🏽‍♂️ I just noticed that the code snippets for these are broken and will make a pull request soon!

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions