mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 10:00:42 +01:00
64 lines
1.2 KiB
XML
64 lines
1.2 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
<name>if()</name>
|
|
|
|
<category>Control</category>
|
|
|
|
<subcategory>Conditionals</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image>if_.gif</image>
|
|
<code>
|
|
for(int i=5; i<height; i+=5) {
|
|
stroke(255); //Set the color to white
|
|
if(i < 35) { //When "i" is less than "35"...
|
|
stroke(0); //...set the color to black
|
|
}
|
|
line(30, i, 80, i);
|
|
}
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
Allows the program to make a decision about which code to execute. If the <b>expression</b> evaluates to <b>true</b>, the statements enclosed within the block are executed and if the <b>expression</b> evaluates to <b>false</b> the statements are not executed.
|
|
</description>
|
|
|
|
<syntax>
|
|
if(<c>expression</c>) {
|
|
<c>statements</c>
|
|
}
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label>expression</label>
|
|
<description>any valid expression that evaluates to true or false</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>statements</label>
|
|
<description>one or more statements to be executed</description>
|
|
</parameter>
|
|
|
|
<returns></returns>
|
|
|
|
<related>
|
|
else
|
|
</related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>Structure</type>
|
|
|
|
<partof>PDE</partof>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</root>
|