Using variables
This presentation is the property of its rightful owner.
Sponsored Links
1 / 10

Using Variables PowerPoint PPT Presentation


  • 40 Views
  • Uploaded on
  • Presentation posted in: General

Using Variables. Declaring Variables. Dim <variable name> As <data type> Variable Name (identifier) Begin with a letter Only letters, digits, and the underscore _ Fewer than 255 characters. Data Types. Examples. Dim intA As Integer Dim dblTaxRate As Double Dim TaxAmount As Currency

Download Presentation

Using Variables

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Using variables

Using Variables


Declaring variables

Declaring Variables

Dim <variable name> As <data type>

Variable Name (identifier)

  • Begin with a letter

  • Only letters, digits, and the underscore _

  • Fewer than 255 characters


Data types

Data Types


Examples

Examples

  • Dim intA As Integer

  • Dim dblTaxRate As Double

  • Dim TaxAmount As Currency

  • Dim MyName As String


Constants

Constants

  • Make program easier to read

    dblArea = dblRadius * dblRadius * 3.14

    dblArea = dblRadius * dblRadius * dblPi

  • Make program easier to modify

    dblTotal = dblPurchase * .06

    dblTotal = dblPurchase * dblTaxrage


Getting input from the user

Getting Input from the User

  • Text box

  • Radio Buttons

  • Check Boxes

    Example:


Integer arithmetic

Integer Arithmetic: \

  • the “\” returns the integer part of division

    • 7 \ 2 return 3

    • 12 \ 5 returns 2

    • 35 \ 7 returns 5

    • 35 \ 6 returns 5


Integer arithmetic div

Integer Arithmetic: Div

  • The Mod operator returns the remainder of division.

    • 7 Mod 2 returns 1

    • 12 Mod 5 returns 2

    • 35 Mod 7 returns 0

    • 35 Mod 6 returns 5


Using option radio buttons

Using Option (Radio) Buttons

  • Use when you want to force the user to make EXACTLY one choice

    Example


The end

The End


  • Login