Home
    Registration
    FAQs
    Terms of service
    Contact us

    Learn ASP
    Databases
    Articles

Math and logic are both a part of computer science; but, right now, let's talk about math.  A computer can only do simple math, but people can write functions to make it do hard math.   First we will talk about the simple math and a few simple functions that VBScript offers:

As you can see, the symbols used to do the math are easy to understand.

  • + for add
  • - for subtract
  • * for multiply
  • / for divide
  • \ for whole number divide
  • ^ for "to the power of"
  • ( ) for "do this first"
  • = for "is equal to"

example:

MoFo = 5 + 6 ^ (2 * 4) * 4

When a variable refers to itself in a statement, it is referring to its current value, the value it had before this statement came up.  Example:

MoFo = 5          'Of course MoFo is 5
MoFo = MoFo + 1  'Now MoFo is it's current value, 5, plus one, now MoFo will = 6
MoFo = MoFo - 2  'MoFo is it's old value, 6, minus 2, now it will = 4

There are also some simple math functions that you can use:

  • sqr (number) for the square root of number
  • int (number) for the whole number part of number
  • fix (number) to round off number to a whole number

example

MoFo = sqr(MoFo) + 5 * 6

By: Matthew Holder