[ Prev | Index | Next ]
Japanese English

Variables

This section deals with the concept of variables, a fundamental aspect of programming.

What are variables?

In the world of programming, values used in calculations are generally stored in "variables."

Variables are like containers for storing values. In other words, values are stored inside variables, and these values can be read or written as needed.

Declaration of Variables

To use variables, you first need to declare them. Declarations are made as follows:

data_type variable_name ;

We'll discuss data types later, but for now, you can think of them as types of containers. Variable names are freely assigned names for variables. For example:

This creates a variable of the string type (a type that handles character-strings) named "s." Running this program doesn't perform any action as it only prepares the variable without processing.

Now, let's assign a value to the variable "s." Please try running the following program:

- Execution Result -

Good Morning !

When you run the above program, "Good Morning!" is displayed on the VCSSL console.

In other words, the content to be displayed by the print function was passed by the variable "s." The print function, after receiving "s," reads the value inside it and displays it on the VCSSL console.

Variable Assignment

In the above explanation, you see the "=" (equal) symbol. This symbol doesn't mean equal in a mathematical sense but signifies "assigning a value to a variable."

To explain further, it means "assigning the value on the right side of the equal sign to the variable on the left side." The assignment is always done from right to left.

Variable Initialization

The first assignment of a value to a declared variable is generally called "initializing the variable."

Uninitialized variables may not function properly. When declaring a variable, make sure to initialize it before using it.

Simultaneous Declaration and Initialization

You can declare and initialize variables simultaneously as follows:

- Execution Result -

Good Morning !

This method not only saves lines but also prevents forgetting to initialize variables.

Declaring Multiple Variables in One Line

If the variable types are the same, it is possible to declare multiple variables in one line as follows:

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


Sponsored Link



Japanese English
Index
News

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