From the course: Visual Basic Essential Training

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Declare a variable

Declare a variable

- [Instructor] In this video, we're looking at how to declare variables of the common numeric types like integer and double. Think of this as the real application of the principles we covered in the slides earlier in this chapter. So I'm in this project Declare and I've made that the startup project. To be clear, the code in this video pertains to local variables, meaning a variable declared within a method body. We'll discuss class and module level variables later. Let's start by opening up the XML file and then double clicking on this button to see the code behind. So we're looking at how to declare a local variable. The four parts are the Dim keyword. That's the declaration start. The identifier or what we would call the name specifying the type in VB. That's what the as keyword as integer. And then here we're assigning a value of 22. An initial value. Here we're specifying as double. In this section we're working with declaring it without specifying the type. Here I'm saying Dim…

Contents