[ Prev | Index | Next ]
Japanese English

Comparison Operations

In this section, we will discuss how to perform comparisons between variables/values.

Comparison Operators

In programming, it's often necessary to compare values to determine conditions for branching or other logic. This is where comparison operators come into play. VCSSL provides the following comparison operators:

Symbol Meaning Supported Types Details
 < Is left less than right? int,
float,
varint,
varfloat
Compares the two values and checks if the left value is smaller than the right value (*).
 > Is left greater than right? int,
float,
varint,
varfloat
Compares the two values and checks if the left value is greater than the right value.
 <= Is left less than or equal to right? int,
float,
varint,
varfloat
Compares the two values and checks if the left value is smaller than or equal to the right value.
 >= Is left greater than or equal to right? int,
float,
varint,
varfloat
Compares the two values and checks if the left value is greater than or equal to the right value.
 == Are left and right equal? int,
float,
varint,
varfloat,
string,
struct
Compares the two values and checks if they are equal.
 != Are left and right different? int,
float,
varint,
varfloat,
string,
struct
Compares the two values and checks if they are different.

*: All results are of bool type.

About "bool" Type

As mentioned above, the result of comparison operations is of the "bool" type. This is a data type that can take two values: "true" or "false." The type name "bool" is an abbreviation of "boolean", so, sometimes, it is referred to as a "boolean" type in some other languages.

While terms like "true" and "false" may not immediately resonate, in most cases, you can consider that "true" means "YES" and "false" means "NO."

Performing Comparisons

Now, let's actually perform some comparison operations. Here, we'll use the symbol "<" to check if the left side is smaller than the right side:

- Execution Result -

true

When you execute this, it will display "true." Here, "true" ("YES") indicates that the left side is smaller than the right side.

On the other hand, what do you think will happen with the following example:

- Execution Result -

false

When you execute this, it will display "false" ("NO"). This indicates that the left side is not smaller than the right side.

Checking for Equality

Next, let's examine equality of two values. Here, we'll use the "==" symbol to check if the left and right sides are equal:

- Execution Request -

true

When you execute this, it will display "true."

What will happen in the following example:

- Execution Request -

false

In this case, it will display "false."

Additionally, you can check for inequality as follows:

- Execution Request -

true

In this case, it will display "true." This indicates that the left and right sides are different.

Furthermore, such conditional checks can also be expressed using the negation operator "!." The negation operator returns "false" if its operand is true and "true" if its operand is false.

For example, "!(A==B)," the negation of "A==B," checks if the left and right sides are different:

- Execution Result -

true

In this case, it also returns "true" since it represents the same condition.

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


Sponsored Link



Japanese English
Index
News From RINEARN
* VCSSL is developed by RINEARN.

Released the Latest Versions of RINEARN Graph and VCSSL - Now Supporting Customizable Tick Positions and Labels!
2024-11-24 - Starting with this update, a new "MANUAL" tick mode is now supported, allowing users to freely specify the positions and labels of ticks on the graph. We'll explain the details and how to use it.

Released Exevalator 2.2: Now Compatible with TypeScript and Usable in Web Browsers
2024-10-22 - The open-source expression evaluation library, Exevalator, has been updated to version 2.2. It now supports TypeScript and can be used for evaluating expressions directly in web browsers. Explains the details.

Behind the Scenes of Creating an Assistant AI (Part 1: Fundamental Knowledge)
2024-10-07 - The first part of a series on how to create an Assistant AI. In this article, we introduce the essential knowledge you need to grasp before building an Assistant AI. What exactly is an LLM-based AI? What is RAG? And more.

Launching an Assistant AI to Support Software Usage!
2024-09-20 - We've launched an Assistant AI that answers questions about how to use RINEARN software and helps with certain tasks. Anyone with a ChatGPT account can use it for free. We'll explain how to use it.

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." Dives 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.

RINEARN Graph 3D Updated and Next Version (Ver.6) Development Has Begun!
2023-09-04 - We have released RINEARN Graph 3D Ver.5.6.34. In addition, we have initiated the development of the next major version, Ver.6! Details inside.

Updated Contents
Circular Wave Animation

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

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

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