Handling Arrays in VBScript

Written by Amrit Hallan

Continued from page 1

for i=0 to 5 document.write names(i) & " " next

There is a nested loop here. Studyrepparttar flow ofrepparttar 107893 for i=0 to 4 loop. The outer loop holdsrepparttar 107894 index ofrepparttar 107895 item that will be compared with every other, next item. For instance, whenrepparttar 107896 first cycle ofrepparttar 107897 loop begins, i is zero, and whenrepparttar 107898 program endsrepparttar 107899 nested loop, j starts at i+1, that is, 1. So turn by turn, item at index zero is compared with every item inrepparttar 107900 array. The outer array goes only till 4 because whenrepparttar 107901 nested loop begins,repparttar 107902 second last item will be compared withrepparttar 107903 last item: j=i+1

Saverepparttar 107904 file, and check it out in your browser.

Now we seerepparttar 107905 use of a dynamically defined array, and how that array can be filled usingrepparttar 107906 inputbox() function.

strings is an array that is re-dimensioned wheneverrepparttar 107907 user types in a new string. When we declare an array, we reserverepparttar 107908 memory space for that array, that is, if we say

dim arr(20)

it means we are reservingrepparttar 107909 space for twenty data items. But what ifrepparttar 107910 user enters just five items? The rest ofrepparttar 107911 space is wasted. To avoid this, we declare a dynamic array.

Inrepparttar 107912 above script, we have a loop whose continuance depends onrepparttar 107913 user input. It keeps on loop untilrepparttar 107914 user enters "fin". So, when "fin" is not entered, only thenrepparttar 107915 dimension ofrepparttar 107916 array strings is increased.

When we are re-dimensioning an array, we have to userepparttar 107917 keyword preserve to preserverepparttar 107918 existing content ofrepparttar 107919 array. In its absence,repparttar 107920 array gets re-dimensioned, butrepparttar 107921 values are lost.

Exit do forcesrepparttar 107922 program to come out ofrepparttar 107923 loop ifrepparttar 107924 condition that terminates it, occurs.

Amrit Hallan is a freelance web designer. For all web site development and web promotion needs, you can get in touch with him at amrit@bytesworth.com or http://www.bytesworth.com. For more such articles, visit http://www.bytesworth.com/articles You can subscribe to his newsletter [BYTESWORTH REACHOUT] on Web Designing Tips & Tricks by sending a blank email at bytesworth-subscribe@topica.com

Tips For the Late Blooming Computer User

Written by Lisa Lake

Continued from page 1

Third, get to know your undo and help keys. "Undo" simply reversesrepparttar last action completed onrepparttar 107892 computer. If you hit something that makes your document go all kerflooey, chances are you can just click "undo" (underrepparttar 107893 edit menu usually) a time or two and you’ll be fine. The "help" menu is another great asset in both word processors and email programs. Rather than sitting there wondering how many times you’ve already asked your boss to explain something, just go to "help" and then type in a question like "how do I set up columns, or "how do I attach a file," andrepparttar 107894 help feature will walk you right throughrepparttar 107895 steps. It can take you a little time, but it’s better than constantly running to your boss and looking helpless.

Fourth, make a computer savvy friend. This is so important. If there’s someone inrepparttar 107896 office who seems to be really good atrepparttar 107897 computer, bring them some cookies or take them to lunch and ask them if you can have a little of their time. Have them sit with you for a few minutes while you work on a document or email. Do this on a few different occasions. Chances are they’ll not only be able to answer your questions, but they’ll be able to point out some great shortcuts for you, too.

Computers don’t have to berepparttar 107898 unconquerable beasts they sometimes appear to be. Just face your fear and approachrepparttar 107899 machine calmly and logically, and chances are you’ll be doing fine. The better you are at using your computer,repparttar 107900 better you’ll be at your job, andrepparttar 107901 happier people will be with you!

Lisa Lake has created a list of top promotional methods on her http://MyAdBlaster.com Lisa also writes ad copy that sells for DrNunley's http://InternetWriters.com Reach her at mailto:lisa@myadblaster.com or 801-328-9006.

    <Back to Page 1
ImproveHomeLife.com © 2005
Terms of Use