Comments and Statements / 文とコメント

文(ステートメント)はプログラムを構成する要素です。「;」(セミコロン)記号は文の終わりに使用され、「文終端子」と呼ばれます。コメントは、人々がプログラムをよりよく理解するためのメモとして使用されます。コメントは2つのスラッシュ(「//」)で始まります。

comment syntax
Structure

View Source Code

/*
 * @name Comments and Statements
 * @arialabel Mustard yellow background
 * @description Statements are the elements that make up programs. The ";" (semi-colon) symbol is used to end statements.
 * It is called the "statement terminator". Comments are used for making notes to help people better understand programs. A comment begins with two forward slashes ("//").
 * <br><br><small><em>This example is ported from the <a href="https://processing.org/examples/statementscomments.html">Statements and Comments example</a>
 * on the Processing website</em></small>
 */
// The createCanvas function is a statement that tells the computer 
// how large to make the window.
// Each function statement has zero or more parameters. 
// Parameters are data passed into the function
// and are used as values for telling the computer what to do.
function setup() {
   // createCanvas(710, 400);
   createCanvas(windowWidth, windowHeight);
}

// The background function is a statement that tells the computer
// which color (or gray value) to make the background of the display window 
function draw() {
   background(204, 153, 0);
}

License

Source code is available on GitHub p5.js website legacy.

All examples are licensed under CC BY-NC-SA 4.0.