Short circuit in the vb.net

Source: Internet
Author: User
I asked, "Have you ever studied vb.net?" ”
You say: "Have studied, and use specially ripe!" ”
I asked, "Do you know vb.net's short circuit concept?" ”
You would say, "Of course, it's not the logic or the #$%^&*?......"

I said, "Yes, that's the thing!" I'll give you a procedure to see if you can handle it. ”

"No problem!" You said.

Here is a section of the program, very simple, see if you can handle.

If not Equals (Txtage.text, String.Empty) and CInt (Txtage.text) > MB Then
Debug.WriteLine ("OK")
End If

Construct your own program, add the code, and then empty your txtage text box and run it 1000 times!

BT? Run 1000 times?

^_^, of course, do not need so much, just dozens of times can be!

Let's predict what will happen!

Thinking ...

"Show OK?" You are tempted to say!

I can only say that you run the program yourself! I have no way to say that you are right or wrong!

You are very impatient to construct the program, and then press the F5.

Hey! I can only watch you smile!

Why why? You may not understand why a dialog box pops up, is a transformation error!

This is the result I want to see!

Yes, that's right, this error is right.

You look at the dialog with the red icon in doubt, wondering ...

"Not supposed to ah!" How could that be? "You whispered," murmured the man.

I want to tell you that this wrong dialog is real, not vs. bug!

Did the book say the short circuit is *&%^$#@!8&^%^%?

No! Because there is a thing in vb.net, called AndAlso!

You'll understand when I'm not done! ^_^

There are two more special logical operators in the vb.net, one is the front andalso and the other is OrElse.

Please keep in mind that these two only follow the short-circuit algorithm!

Understand?





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.