[ Prev | Index | Next ]
Japanese English

Logical Operations

In this section, we will discuss how to perform logical operations.

Logical Operators

To check if either or both of two boolean values (like the results from comparison operations) are true, we use logical operators.

VCSSL supports the following logical operators:

Symbol Meaning Supported Types Details
 && Logical AND bool The result becomes true only when both the right and left values are true. If either one is false, the result becomes false.
 || Logical OR bool The result becomes true if either the right or left value is true. The result becomes false only when both the right and left values are false.
 ! Logical NOT bool The result becomes false if the value is true, and true if the value is false.

Combining Two Comparison Results

Let's look at an example combining two comparison results:

- Execution Result -


When you execute this, it will display true. Both b1 and b2 are true, so b1 && b2 also becomes true.

Now, let's see what happens with the following:

- Execution Result -


This time, it will display false. While b1 is true, b2 is false, causing b1 && b2 to evaluate to false. The "&&" operator returns true only if all compared values are true.

Mixing Comparisons and Logical Operations

In the previous examples, we firstly stored the results of comparison operations into bool type variables, and then performed logical operations on them. However, in practical code, it's cumbersome to create bool variables for every comparison.

Therefore, you can mix and write them as follows:

- Execution Result -


When you execute this, it will display true.

Combining Multiple Logical Operations

To process multiple logical operations together, you need to use parentheses like this:

- Execution Result -


This evaluates to "( true && true ) || ( false && false ) || false," which is equivalent to "true || false || false," so when executed, it displays true.


You may need the opposite of a comparison result (true becomes false, and vice versa). In such cases, you can use the negation symbol "!"

- Execution Result -


When you execute this, it displays false.

Acknowledgement: We greatly appreciate the cooperation of two ChatGPT AIs in translating this article!
» How we translated this article

Sponsored Link

Japanese English

Software Updates: Command Expansion in RINEARN Graph, and English Support in VCSSL
2024/02/05 - We updated our apps. This updates include "Enhancing the Command-Line Features of RINEARN Graph" and "Adding English Support to VCSSL." Delves into each of them!

Inside the Repetitive Execution Speedup Impremented in Vnano Ver.1.1
2024/01/17 - Delves into the update in Vnano 1.1 from a developer's viewpoint, providing detailed insights into the specific improvements made to the internal structure of the script engine.

Scripting Engine Vnano Ver.1.1 Released: Dramatic Speed Improvement for Repetitive Executions of the Same Content
2023/12/22 - Released the Vnano script engine Ver.1.1. In this version, we've made significant enhancements in processing speed by reducing the overhead of handling requests. Explains the details.

Updated Contents
Circular Wave Animation

Draws the circular wave as 3D animation, under the specified wave parameters.
Sine Wave Animation

Draws the sine wave as animation, under the specified wave parameters.
Tool For Converting Units of Angles: Degrees and Radians

A GUI tool for converting the angle in degrees into radians, or radians into degrees.
Connector Fatal Exception - Specification
The unchecked exception thrown when errors have occurred, caused by incorrect implementations (might be bugs).
Connector Exception - Specification
The checked exception thrown when errors have occurred, cause by expected normal problems.