0, "(empty string), null, empty, and nothing

Source: Internet
Author: User
0, "" (empty string), null, empty, and the difference with nothing
Answer the following questions first! After the following descriptions, variables A, B, C, and D are equal to 0,
"", Null, empty, and nothing?
Dim
Dim B as string
Dim C as integer
Dim D as object
A is equal to empty, because uninitialized "unfinalized variables" are equal to empty. However
Test A = "" or a = 0, you can also get the true value.
B is equal to "", because uninitialized non-fixed-length "strings" are equal "". Note that
B <> null.
C is equal to 0. Is there any problem?
D equals to nothing. "object variables" that have not been set are all equal to "nothing", but please do not
Use D = nothing, and use D is nothing to determine whether D is equal to nothing,
Because the equal sign is not =.
The most confusing part is the reserved word null. Please refer to the following statement:
Print x = NULL
Print x <> null
The results are all output null (Neither true nor false), because any formula only
To include null, the formula is equal to null. In fact, you want to determine whether a data is null.
It cannot be used:
If X = NULL then' will always get null
Use:
If isnull (x) then
Which data type is equal to null? Except for the null formula, there is no input
Which data fields (in the database) are equal to null.

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.