0 Basic Easy Language Introductory course (v) Logical data type _ Easy language

Source: Internet
Author: User

In the last article to introduce 0 basic easy language Introductory course (iv) data type, the last article on the value of text type knowledge, today to introduce the logical data.

The specific methods and steps are as follows:

1, the logical type of data is not true or false:

First to apply for a local variable (a) Type: logical type, write code: a=1>2, then the output should be false, because equal to 1 is the assignment and 1, and then write the code 1 is greater than 2, so this is false, see the following figure shows:


2. Relational operators:

What you should note in the above figure is that the equals number after a is the assignment symbol, and the following ≥,≠,< some symbols are relational operators.

The relational operator does not have to set the variable to be assigned to it, and he can run the standard output directly, as shown in the following figure:


Supplementary knowledge:

data: A collection of symbols that can be entered into a computer and recognized and processed by a computer. The data is divided into different types according to certain criteria, and the data type is easily called by language. Easy language data types can be divided into basic data types and special data types.

1. Basic data types

There are 6 basic data types: numeric, logical, date-time, text, byte set, subroutine-pointer.

The numerical type also includes: byte type, short integer type, integer type, long integer type, decimal type, double decimal type.

The length of easy language data types and the range of storage

All types of data occupy a certain amount of storage space in memory, byte is the basic unit of computer data processing, one byte is composed of 8 bits, namely 8 bits (1byte=8bit). such as: byte-type value range: 0--255, is binary 00000000--11111111 converted to decimal data, integer value range is: -2,147,483,648--2,147,483,647, binary -1e32--1e32-1 ( -1x 1032--1x1032-1) into decimal data.

If you assign a value to a data type that is outside its range, a data overflow occurs, such as assigning a value of 266 to a byte type of data, and an error occurs.

The greater the number of bytes in a data type, the larger the amount of data is accommodated. The larger the memory footprint. Therefore, when choosing a data type, it is necessary to avoid space waste and to prevent data overflow.

2. Special data

An easy language special data type is a data type other than the base data type. Includes common data types, library definition data types, internal component data types, and custom data types.

Universal Data type: used only within the system to match all basic data types, library definition data types, and custom data types.

Library definition data type: provided by the easy Language support library, can be used directly, same as the basic data type.

Internal component data type: Each internal component of an easy language can be used as a data type.

Custom data types: Users can define new data types in their programs at any time, and you need to set the name of the data type and its members when you customize the data type, where the data type member has the same property setting method as the variable setting method.

3. Conversion of data types

When writing programs, there are times when you need to compare data types, you can compare the same data types directly, and you need to convert and compare different data types first.

The commands for converting between data types that are commonly used in easy languages are:

To value () command to convert a general-purpose data to a double-precision decimal type.
to decimal () command to convert a general-purpose data to a decimal type.
to Integer () command to convert a general-purpose data to an integer.
To text () command to convert a general-purpose data to a text type.
to byte set () command to convert a general-purpose data to a byte set type.
The To Time () command, which converts a text-type data to a datetime type.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.