Sign in to follow this  
namingway

Visual Basic variables

Recommended Posts

namingway    114
I've noticed with VB you can declare your variables Dim variable = value or Dim variable As type = value Which one is more standard to use? e.g. which one of the following is a better choice Dim health = 900; Dim health As Integer = 900;

Share this post


Link to post
Share on other sites
gan    166
link

Quote:

But the default changed in .NET (Option Explicit is On by default) and we were strongly encouraged to declare everything. Not only did it help the compiler catch errors so the application didn't crash at runtime, but the code ran faster because the variables were "early bound" instead of "late bound". With late binding, the compiler has to add code to figure out what a variable is before using it and that slows everything down. VB 6 was slower for the same reason.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this