GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Processing
  • Download
  • Reference
  • Environment
  • Libraries
  • Tools
  • Wiki
  • Tutorials
  • Examples
  • Books
  • Forum
  • Overview
  • People
  • Privacy

This view

  • Original page
  • New address

GeezerVison is showing processing.org — && (logical AND) / Reference

Reference+
Documentation→Reference→Control→Logical Operators

Name

&& (logical AND)

Description

Compares two expressions and returns true only if both evaluate to true. Returns false if one or both evaluate to false. The following list shows all possible combinations:

true && false // Evaluates false because the second is false
false && true // Evaluates false because the first is false
true && true // Evaluates true because both are true
false && false // Evaluates false because both are false

Examples

  • size(400, 400);
    for (int i = 20; i <= 380; i += 20) {
      if ((i > 140) && (i < 240)) {
        stroke(0);  // Set color to black
      } else {
        stroke(255);  // Set color to white
      }
      line(120, i, 320, i);
    }

Syntax

  • expression1 && expression2

Parameters

  • expression1any valid expression
  • expression2any valid expression

Related

  • logicalOR
  • logicalNOT
  • if
Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.