<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6472893974396894393</id><updated>2011-11-27T17:17:42.839-08:00</updated><title type='text'>Musannif</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default?start-index=101&amp;max-results=100'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>475</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1949561632102325529</id><published>2008-09-07T11:58:00.001-07:00</published><updated>2008-09-07T11:58:46.993-07:00</updated><title type='text'>Example: The Error Subtype</title><content type='html'>Dim datBirth&lt;br /&gt;Dim lngAge&lt;br /&gt;datBirth = InputBox("Please enter the date on which you were born.")&lt;br /&gt;If IsDate(datBirth) Then&lt;br /&gt;lngAge = GetAge(datBirth)&lt;br /&gt;If Not IsError(lngAge) Then&lt;br /&gt;MsgBox "You are " &amp;amp; lngAge &amp;amp; " years old."&lt;br /&gt;Else&lt;br /&gt;If lngAge = 1000 Then&lt;br /&gt;'This error means that the date was greater&lt;br /&gt;'then the current system date.&lt;br /&gt;MsgBox "That date was greater than the current system date."&lt;br /&gt;Else&lt;br /&gt;'An unknown error occured.&lt;br /&gt;MsgBox "The error " &amp;amp; lngAge &amp;amp; " occured in the GetAge()"_&lt;br /&gt;&amp;amp; "function"&lt;br /&gt;End If&lt;br /&gt;End If&lt;br /&gt;Else&lt;br /&gt;MsgBox "You did not enter a valid date."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Keep in mind that GetAge ( ) is a totally fictional function, and you cannot actually run this code. The point here is only to illustrate how someone might use the Error subtype, and how your code might have to respond to it. You could not easily implement the use of the Error subtype yourself in VBScript because the VBScript does not support the CVErr ( ) conversion function, as Visual Basic does. Therefore, without the aid of Visual Basic, you could never coerce the subtype of a variable to be Error.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/error-subtype.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1949561632102325529?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1949561632102325529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1949561632102325529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1949561632102325529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1949561632102325529'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/example-error-subtype.html' title='Example: The Error Subtype'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4545684636735654168</id><published>2008-09-07T11:57:00.001-07:00</published><updated>2008-09-07T11:59:52.298-07:00</updated><title type='text'>The Error Subtype</title><content type='html'>The error subtype is seldom used. However, there's a remote chance that you might end up coming across a component or function that uses the Error subtype to indicate that an error occurred in the function. I am not necessarily endorsing this methodology, but what you might encounter is a function that returns a Variant value that will either contain the result of the function, or an error number. Let's say its a fictional function called GetAge ( ) that returns a person's age in years. This function would take a date as a parameter, and return to you the person's age, based on the computer's current system date. If an error occurred in the function, then the return value would instead contain an error number indicating what went wrong. Ponder on the fictional example given in the next post.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/example-error-subtype.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4545684636735654168?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4545684636735654168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4545684636735654168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4545684636735654168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4545684636735654168'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/error-subtype.html' title='The Error Subtype'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-137839045156634386</id><published>2008-09-07T11:55:00.001-07:00</published><updated>2008-09-07T11:55:59.381-07:00</updated><title type='text'>Why Destroy an Object?</title><content type='html'>Why would you want to destroy an object using Set &lt;variable&gt; = Nothing syntax? It's a good idea to do this when you are done using an object, because destroying an object frees up the memory it was taking up. Objects take up a great deal more memory than normal variables. Also, for reasons that are too complex to go into here. In short, keeping object variable around longer than necessary can cause fatal memory errors. So, it's a good idea to develop a habit of setting all object variables equal to Nothing immediately after you are done with them.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/object-subtype.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-137839045156634386?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/137839045156634386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=137839045156634386' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/137839045156634386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/137839045156634386'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/why-destroy-object.html' title='Why Destroy an Object?'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6888979742044380929</id><published>2008-09-07T11:53:00.000-07:00</published><updated>2008-09-07T11:56:54.519-07:00</updated><title type='text'>Special Value of 'Nothing'</title><content type='html'>Nothing is a special value that applies only to variables with the Object subtype. An object variable is equal to the value Nothing when the subtype is Object, but the object in the variable has either been destroyed or has not yet been instantiated. When testing for whether an object variable is equal to the value Nothing, you do not use the = operator, as you normally would to test for a specific value. Instead, you have to use the special operator Is. However, when you wan to destroy an object, you have to use the Set Keyword in combination with the = operator. Let's look at an example:&lt;br /&gt;&lt;br /&gt;Dim objFSO&lt;br /&gt;Dim boolExists&lt;br /&gt;Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")&lt;br /&gt;If IsObject(objFSO) Then&lt;br /&gt;boolExists = objFSO.FileExists("C:/autoexec.bat")&lt;br /&gt;MsgBox boolExists&lt;br /&gt;Set objFSO = Nothing&lt;br /&gt;If objFSO Is Nothing Then&lt;br /&gt;MsgBox "The object has been destroyed"&lt;br /&gt;End If&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/object-subtype.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/why-destroy-object.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6888979742044380929?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6888979742044380929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6888979742044380929' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6888979742044380929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6888979742044380929'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/special-value-of-nothing.html' title='Special Value of &apos;Nothing&apos;'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7021992371101586039</id><published>2008-09-07T11:52:00.001-07:00</published><updated>2008-09-07T11:55:23.273-07:00</updated><title type='text'>IsObject ( ) Function</title><content type='html'>Ponder on the following example:&lt;br /&gt;&lt;br /&gt;Dim objFSO&lt;br /&gt;Dim boolExists&lt;br /&gt;Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")&lt;br /&gt;If IsObject(objFSO.FileExists("C:/autoexec.bat")&lt;br /&gt;MsgBox boolExists&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;This example illustrates the use of the IsObject ( ) funtion, which is similar to the IsNumeric ( ) and IsDate ( ) Functions that I explained in other posts. If the variable holds a reference to an object, then the function will return True. Otherwise, it will return False.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/object-subtype.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/special-value-of-nothing.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7021992371101586039?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7021992371101586039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7021992371101586039' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7021992371101586039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7021992371101586039'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/isobject-function.html' title='IsObject ( ) Function'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6737259244090052048</id><published>2008-09-07T11:50:00.000-07:00</published><updated>2008-09-07T11:53:45.335-07:00</updated><title type='text'>FileSystemObject</title><content type='html'>Here I am going to tell you that how variables with the object subtype behave. Let's look at some code that actually uses a real object, in this case the FileSystemObject, which is part of a collection of subjects that allow your VBScript code to interact with the Windows file system.&lt;br /&gt;&lt;br /&gt;Dim objFSO&lt;br /&gt;Dim boolExists&lt;br /&gt;Set objFSO = WScript.CreateOnject("Scripting.FileSystemObject")&lt;br /&gt;boolExists = objFSO.FileExists("C:/autoexec.bat")&lt;br /&gt;MsgBox boolExists&lt;br /&gt;&lt;br /&gt;In this code, we create a FileSystemObject object and store it in the variable called objFSO. We then use the FileExists method of the object to test for the existence of the autoexec.bat file. Then we display the result of this test in a dialogue box. Note the use of the Set Keyword. When changing the value of an object variable, you must use Set.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/object-subtype.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/isobject-function.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6737259244090052048?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6737259244090052048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6737259244090052048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6737259244090052048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6737259244090052048'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/filesystemobject.html' title='FileSystemObject'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6855966372179905834</id><published>2008-09-07T11:49:00.001-07:00</published><updated>2008-09-07T11:52:12.631-07:00</updated><title type='text'>Class, Properties, and Methods</title><content type='html'>You could create a class called "Dog". This Dog class could have properties called "Color", "Breed", and "Name", and it could have methods called "Bark" and "Sit". The class defination would have code to implement these properties and methods. Objects created at runtime from the Dog class would be able to set and read the properties and call the methods. A class typically exists as part of a component. For example, you might have a component called "Animals" that contains a bunch of different classes like "Dog", "Elephant", and "Rhino". The code to create and use a Dog object would look something like this:&lt;br /&gt;&lt;br /&gt;Dim objMyDog&lt;br /&gt;Set objMyDog = WScript.CreateObject("Animals.Dogs")&lt;br /&gt;objDog.Name = "Buddy"&lt;br /&gt;objDog.Breed = "Poodle"&lt;br /&gt;objDog.Color = "Brown"&lt;br /&gt;objDog.Bark&lt;br /&gt;objDog.Sit&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/object-subtype.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/filesystemobject.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6855966372179905834?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6855966372179905834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6855966372179905834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6855966372179905834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6855966372179905834'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/class-properties-and-methods.html' title='Class, Properties, and Methods'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8382363619828158447</id><published>2008-09-07T10:45:00.000-07:00</published><updated>2008-09-07T11:50:36.769-07:00</updated><title type='text'>The Object Subtype</title><content type='html'>As the name suggests, a variable will have the Object subtype when it contains a reference to an object. An object is a special construct that contains properties and methods. A property is analogous to a variable, and an method is analogous to a function or procedure. An object is essentially a convenient way of encompassing both data (in the form of properties) and  functionality (in the form of methods). Objects are always created at runtime from a class which is a template from which objects are created (or instantiated).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/class-properties-and-methods.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8382363619828158447?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8382363619828158447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8382363619828158447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8382363619828158447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8382363619828158447'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/object-subtype.html' title='The Object Subtype'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2781501291874133299</id><published>2008-09-05T13:23:00.000-07:00</published><updated>2008-09-05T13:24:21.019-07:00</updated><title type='text'>Empty Strings and Nulls</title><content type='html'>Here is an example of the type of thing you want to do when you're concerned that a database column might return a Null value:&lt;br /&gt;&lt;br /&gt;strCustomerName = rsCustomers.Fields("Name").Value&lt;br /&gt;If IsNull(strCustomerName) Then&lt;br /&gt;strCustomerName = ""&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Here we are assigning the value of the "Name" column in a database table to the variable strCustomerName. If the Name column in the database allows Null values, then we need to be concerned that we might end up with a Null value in ur variable. So we use IsNull ( ) to test the value.If IsNull ( ) returns True, then we assign an empty string to the variable instead. Empty strings are much more friendly then Nulls. Here is a handy shortcut that achieves the same exact thing as the above code.&lt;br /&gt;&lt;br /&gt;strCustomerName = "" &amp;amp; rsCustomers.Fields("Name").Value&lt;br /&gt;&lt;br /&gt;Here we are appending an empty string to the value coming from the database. This takes advantage of VBSctipt's implicit type coercion behavior. Concatenating an empty string with a Null value transforms that value into an empty string, and concatenating an empty string to a valid string has not effect at all, so it is a win-win situation; if the value is Null, it gets fixed, and if it's not Null, it's left alone.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2781501291874133299?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2781501291874133299/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2781501291874133299' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2781501291874133299'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2781501291874133299'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/empty-strings-and-nulls.html' title='Empty Strings and Nulls'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2102304353284906097</id><published>2008-09-05T13:22:00.001-07:00</published><updated>2008-09-05T13:25:06.883-07:00</updated><title type='text'>Invalid Use of Null</title><content type='html'>Dim varTest&lt;br /&gt;varTest = Null&lt;br /&gt;varTest = CLng(varTest)&lt;br /&gt;&lt;br /&gt;Running this code produces an error on line 3: "Invalid Use of Null". This is a common error with many VBScript functions that don't like Null values to be passed into them. Take a look at the odd behavior that results from this code:&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;Dim lngTest&lt;br /&gt;varTest = Null&lt;br /&gt;lngTest = 2 + varTest&lt;br /&gt;MgsBox(lngTest)&lt;br /&gt;&lt;br /&gt;Did you see what happened? When we added the number 2 to the value Null, the result was Null. Once again when you mix invalid data (Null) with valid data (the number 2, in this case), you always end up with invalid data.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-strings-and-nulls.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2102304353284906097?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2102304353284906097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2102304353284906097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2102304353284906097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2102304353284906097'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/invalid-use-of-null.html' title='Invalid Use of Null'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-648600665114179673</id><published>2008-09-05T13:20:00.001-07:00</published><updated>2008-09-05T13:23:38.424-07:00</updated><title type='text'>Null and Mathematical Operations</title><content type='html'>Your code has to be concerned with receiving Null values from a database. The reson I say that you need to be concerned is that, since Null is an indicator of invalid data, Null can cause trouble for you if you pass it to certain functions or try and use it to perform mathematical operations. Try the Code given in next post.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/invalid-use-of-null.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-648600665114179673?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/648600665114179673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=648600665114179673' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/648600665114179673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/648600665114179673'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/null-and-mathematical-operations.html' title='Null and Mathematical Operations'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3458763687761001269</id><published>2008-09-05T13:19:00.001-07:00</published><updated>2008-09-05T13:21:52.489-07:00</updated><title type='text'>Null Example</title><content type='html'>'This code does not work like you might expect&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = Null&lt;br /&gt;If varTest = Null Then&lt;br /&gt;MsgBox "The variable has a Null value."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;You did not see any dialogue box pop up did you? That is because the expression If varTest = Null always returns False. If you want to know if a a variable contains a Null value, you must use the IsNull ( ) function:&lt;br /&gt;&lt;br /&gt;If IsNull(varTest) = True Then&lt;br /&gt;MsgBox "The variable has a Null value."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/null-and-mathematical-operations.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3458763687761001269?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3458763687761001269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3458763687761001269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3458763687761001269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3458763687761001269'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/null-example.html' title='Null Example'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6542391091356477656</id><published>2008-09-05T13:17:00.000-07:00</published><updated>2008-09-05T13:20:12.782-07:00</updated><title type='text'>Testing Null</title><content type='html'>The syntx for assigning and testing for Null values is similar to the way the Empty value/subtype works. Here is some code that assigns a Null value to a variable:&lt;br /&gt;&lt;br /&gt;varTest = Null&lt;br /&gt;&lt;br /&gt;However, you cannot directly test for the value of Null in the same way that you can with Empty - you must use only the IsNull ( ) function to test for a Null value. This is because Null represents invalid data, and when you try to make a direct comparison using invalid data, the result is always invalid data. Try running the code given on next post.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/null-example.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6542391091356477656?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6542391091356477656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6542391091356477656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6542391091356477656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6542391091356477656'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/testing-null.html' title='Testing Null'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6178055109145842141</id><published>2008-09-05T13:16:00.001-07:00</published><updated>2008-09-05T13:18:44.497-07:00</updated><title type='text'>Null From Another Angle</title><content type='html'>Another way to think about it is that Empty generally happens by default - it is implicit, because a variable is Empty until you place something in it. Null, on the other hand, is explicit - a variable can only be Null, if some code made it that way.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/testing-null.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6178055109145842141?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6178055109145842141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6178055109145842141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6178055109145842141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6178055109145842141'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/null-from-another-angle.html' title='Null From Another Angle'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7612203895250968860</id><published>2008-09-05T13:14:00.000-07:00</published><updated>2008-09-05T13:17:25.164-07:00</updated><title type='text'>Null</title><content type='html'>The value/subtype of Null, in a confusing way, is similar to the value/subtype of Empty. The distinction may seem esoteric, but Empty indicates that a variable is uninitialized, whereas Null indicates the absence of valid data. Empty means that no value has been placed into a variable, whereas a Variant variable can only have the value/subtype of null after the value of Null has been placed into it. In other words, a variable can only be Null if the Null value has explicitly been placed into it. Null is a special value that is most often encountered in database tables. A column in a database is Null when there is no data in it, and if your code is going to read data from a database, you have to ready for Null values.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/null-from-another-angle.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7612203895250968860?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7612203895250968860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7612203895250968860' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7612203895250968860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7612203895250968860'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/null.html' title='Null'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4726921893515326425</id><published>2008-09-05T13:13:00.001-07:00</published><updated>2008-09-05T13:13:51.408-07:00</updated><title type='text'>Test Empty</title><content type='html'>You can also test for whether a variable is empty in either of two ways:&lt;br /&gt;&lt;br /&gt;If varTest = Empty Then&lt;br /&gt;MsgBox "The variable is empty."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;OR:&lt;br /&gt;&lt;br /&gt;If IsEmpty(varTest) Then&lt;br /&gt;MsgBox "The variable is empty."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;The IsEmpty ( ) function returns a Variant value of the Boolean subtype with the value of True if the variable is empty, False if not.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4726921893515326425?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4726921893515326425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4726921893515326425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4726921893515326425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4726921893515326425'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/test-empty.html' title='Test Empty'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5798162578825265378</id><published>2008-09-05T13:12:00.001-07:00</published><updated>2008-09-05T13:14:33.880-07:00</updated><title type='text'>Empty Example 2</title><content type='html'>Dim varTest&lt;br /&gt;MsgBox CLng(varTest)&lt;br /&gt;MsgBox CStr(varTest)&lt;br /&gt;&lt;br /&gt;When you run this script, it will produce two dialogue boxes. The first box displays a 0 because Empty is 0 when represents as a number. The second box displays nothing because Empty is an "empty" or "zero length" string when represented as a String.&lt;br /&gt;&lt;br /&gt;Once you place a value in a variant variable, it is no longer empty. It will take on another subtype, depending on what type of value you place in it. This is also true when you use a conversion function to coerce the subtype. However, if you need to, you can force the variable to become empty again by using the Empty keyword directly:&lt;br /&gt;&lt;br /&gt;varTest = Empty&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/test-empty.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5798162578825265378?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5798162578825265378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5798162578825265378' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5798162578825265378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5798162578825265378'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/empty-example-2.html' title='Empty Example 2'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3324569595868542861</id><published>2008-09-05T13:10:00.000-07:00</published><updated>2008-09-05T13:13:15.389-07:00</updated><title type='text'>Empty Example 1</title><content type='html'>Dim varTest&lt;br /&gt;MsgBox TypeName(varType)&lt;br /&gt;&lt;br /&gt;Run the script using Windows Script Host and you'll see the value as "Empty". The subtype is Empty because we have not yet placed any value in it. Empty is both the initial subtype and the initial value of the variable. However, Empty is not a value that you can really do nothing with. You can display it on the screen or print it on paper. It only exists to represent the condition of the variable not having had any value placed in it. Try the code on next page.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-example-2.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3324569595868542861?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3324569595868542861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3324569595868542861' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3324569595868542861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3324569595868542861'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/empty-example-1.html' title='Empty Example 1'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1761726816547879065</id><published>2008-09-05T13:09:00.001-07:00</published><updated>2008-09-05T13:11:55.535-07:00</updated><title type='text'>Empty</title><content type='html'>Empty is a special value that can only be held in a Variant variable. In Visual Basic, variables declared as any of the specific data types cannot hold the value of Empty-only variables declared as Variant. In VBScript, of course, all variables are Variant variables. A Variant variable is "empty", and has the Empty subtype, after it has been declared, but before any value has been placed within it. In other words, Empty is the equivalent of "not initialized". Once any type of value has been placed into the variable, it will take on one of the other subtype, depending on what the value is. Let us take a look at some examples:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-and-null.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty-example-1.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1761726816547879065?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1761726816547879065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1761726816547879065' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1761726816547879065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1761726816547879065'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/empty.html' title='Empty'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8535952837357948342</id><published>2008-09-05T13:07:00.000-07:00</published><updated>2008-09-05T13:15:54.745-07:00</updated><title type='text'>Empty and Null</title><content type='html'>Empty and Null are special in that they do not have a corresponding specific Visual Basic data type. In fact, it is a bit of misnomer to call these subtypes, because they are actually special values that a Variant variable can hold. When the subtype of a variable is Empty or Null, its value is also either Empty or Null. This is different then the other subtypes, which only describe the type of value that the variable holds, not the value itself. For example, when the subtype of a variable is Long, the value of the variable can be 0, or 15, or 2,876,456, or one of about 4.3 billion numbers (-2,147,483,648 to 2,147,483,647). However, when the subtype of a variable is Empty, it's value is also always a special value called Empty. In the same fashion, when the subtype of a variable is Null, the value is always a special value called Null.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/empty.html"&gt;Empty&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/09/null.html"&gt;Null&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8535952837357948342?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8535952837357948342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8535952837357948342' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8535952837357948342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8535952837357948342'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/09/empty-and-null.html' title='Empty and Null'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2573308859555733910</id><published>2008-08-30T04:41:00.001-07:00</published><updated>2008-08-30T04:41:38.337-07:00</updated><title type='text'>Plus (+) Operator</title><content type='html'>VBScript allows you to use the plus (+) operator to concatenate strings. However, this usage of plus (+) operator should be avoided. This is because the plus (+) operator, when used to concatenate strings, can cause unwanted implicit type coercion. Try this code:&lt;br /&gt;&lt;br /&gt;Dim strFirst&lt;br /&gt;Dim lngSecond&lt;br /&gt;strFirst = CStr(50)&lt;br /&gt;lngSecond = CLng(100)&lt;br /&gt;MsgBox strFirst + lngSecond&lt;br /&gt;&lt;br /&gt;The resulting dialogue box will display the number 150, which means that it added the two numbers mathematically rather than concatenating them. Now, this is admittedly a very silly example, but it illustrates that the plus (+) operator has different effects when you are not using it in a strictly mathematical context. The plus (+) operator uses the following rules when deciding what to do.&lt;br /&gt;&lt;br /&gt;If both variables have the String subtype, the VBScript will concatenate the.&lt;br /&gt;If both variables have any of the numeric subtype, then VBScript will add them.&lt;br /&gt;If one of the variable has a numeric subtype, and the other has the String subtype, then VBScript will attempt to add them. If the variable with the String subtype does not contain a number, then a "Type Mismatch" error will occur.&lt;br /&gt;&lt;br /&gt;Your best bet is to not worry about these rules and remember only the following:&lt;br /&gt;&lt;br /&gt;Use the plus (+) operator only when you explicitly want to perform math on numeric values.&lt;br /&gt;Always use the &amp;amp; operator to concatenate strings.&lt;br /&gt;Never use the plus (+) operator to concatenate strings.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2573308859555733910?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2573308859555733910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2573308859555733910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2573308859555733910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2573308859555733910'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/plus-operator.html' title='Plus (+) Operator'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5899518113666924</id><published>2008-08-30T04:39:00.000-07:00</published><updated>2008-08-30T04:42:36.836-07:00</updated><title type='text'>Another Coercion Example</title><content type='html'>Run the following code in Windows Script Host:&lt;br /&gt;&lt;br /&gt;Dim intTest&lt;br /&gt;intTest = CInt(100)&lt;br /&gt;MsgBox "TypeName after initialization to 100: " &amp;amp; _&lt;br /&gt;TypeName(intTest)&lt;br /&gt;intTest = intTest + 1000000&lt;br /&gt;MsgBox "TypeName after adding 1,000,000: " &amp;amp; _&lt;br /&gt;TypeName(intTest)&lt;br /&gt;intTest = intTest + 10000000000&lt;br /&gt;MsgBox "TypeName after adding another 10,000,000,000: " &amp;amp; _&lt;br /&gt;TypeName(intTest)&lt;br /&gt;&lt;br /&gt;Notice that we initialized the variable with a value of 100, and use the CInt ( ) function to coerce the subtype into Integer. The first call to the TypeName ( ) function reflects String. Then we added 1,000,000 to the variable. The next call to the TypeName ( ) function reveals that VBScript coerced the subtype to Long. Why did it do this? Because we exceeded the upper limit of the Integer subtype, which is 32,767. VBScript will promote numeric subtype when the value exceeds the upper or lower limits of the current numeric subtype. Finally, we add another ten billion to the variable. This exceeds the upper limit of the Long subtype, so VBScript upgrades the subtype to Double.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/plus-operator.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5899518113666924?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5899518113666924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5899518113666924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5899518113666924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5899518113666924'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/another-coercion-example.html' title='Another Coercion Example'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4676898913527264539</id><published>2008-08-30T04:38:00.001-07:00</published><updated>2008-08-30T04:40:56.478-07:00</updated><title type='text'>Long Coerced into String</title><content type='html'>Dim lngTest&lt;br /&gt;lngTest = CLng(100)&lt;br /&gt;MsgBox "Type after initialization: " &amp;amp; TypeName(lngTest)&lt;br /&gt;lngTest = lngTest + 1000&lt;br /&gt;MsgBox "TypeName after adding 1000: " &amp;amp; TypeName(lngTest)&lt;br /&gt;lngTest = lngTest * 50&lt;br /&gt;MsgBox "TypeName after multiplying the 50: " &amp;amp; TypeName(lngTest)&lt;br /&gt;lngTest = "Hello"&lt;br /&gt;MsgBox "TypeName after assigning value of 'Hello': " &amp;amp; TypeName(lngTest)&lt;br /&gt;&lt;br /&gt;If you run this code using Windows Script Host, you'll see that the first three calls to the TypeName ( ) function reveal that the subtype is Long. Then, after we changed the value of the variable to "Hello", the subtype is automatically coerced into String. What this code illustrates is that, once the subtype is established as Long, it stays Long as long as we keep changing the value to other numbers. VBScript has no reason to change it, because the values we put in it remain in the range of the Long subtype. However, when we place text in the variable, VBScript sees that the new value is not appropriate for the Long subtype, so it changes it to String.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/another-coercion-example.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4676898913527264539?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4676898913527264539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4676898913527264539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4676898913527264539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4676898913527264539'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/long-coerced-into-string.html' title='Long Coerced into String'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2003065363812993854</id><published>2008-08-30T04:36:00.000-07:00</published><updated>2008-08-30T04:39:28.035-07:00</updated><title type='text'>Subtype Change</title><content type='html'>Din lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;MsgBox "TypeName After InputBox: " &amp;amp; TypeName(lngAge)&lt;br /&gt;If IsNumeric(lngAge) Then&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "TypeName after Adding 50: " &amp;amp;TypeName(lngAge)&lt;br /&gt;MsgBox "In 50 years you will be  " &amp;amp; lngAge &amp;amp; "years old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;While you have to aware of implicit type coercion, there is no reason to fear it. VBScript is not going to arbitrarily go around changing subtypes on you. Implicit type coercion only happens when you assign a new value to a variable that does not fit the current subtype. Generally, once a Variant variable has a subtype (based on the value first placed within it, or based on a subtype that your code explicitly coerced), it will keep that subtype as you place new value in the variable.&lt;br /&gt;&lt;br /&gt;Where do you need to watch out for implicit type coercion is when you are dealing with a mixture of data types. I saw this in the example: when the data comes back from the InputBox ( ) function, it was a string. Then we did soem math on it, which turned it into a number. Give this code a try:&lt;br /&gt;&lt;br /&gt;Dim lngTest&lt;br /&gt;lngTest = CLng(100)&lt;br /&gt;MsgBox "Type after initialization: " &amp;amp; TypeName(lngTest)&lt;br /&gt;lngTest = lngTest + 1000&lt;br /&gt;MsgBox "TypeName after adding 1000: " &amp;amp; TypeName(lngTest)&lt;br /&gt;lngTest = lngTest * 50&lt;br /&gt;MsgBox "TypeName after multiplying the 50: " &amp;amp; TypeName(lngTest)&lt;br /&gt;lngTest = "Hello"&lt;br /&gt;MsgBox "TypeName after assigning value of 'Hello': " &amp;amp; TypeName(lngTest)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/long-coerced-into-string.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2003065363812993854?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2003065363812993854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2003065363812993854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2003065363812993854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2003065363812993854'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/subtype-change.html' title='Subtype Change'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2476904894286887191</id><published>2008-08-30T04:35:00.001-07:00</published><updated>2008-08-30T04:37:58.430-07:00</updated><title type='text'>Double Subtype - TWO</title><content type='html'>Din lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;MsgBox "TypeName After InputBox: " &amp;amp; TypeName(lngAge)&lt;br /&gt;If IsNumeric(lngAge) Then&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "TypeName after Adding 50: " &amp;amp;TypeName(lngAge)&lt;br /&gt;MsgBox "In 50 years you will be  " &amp;amp; lngAge &amp;amp; "years old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;In the example above, VBScript automatically knew that we wnated the value the variable to be a number because our code added 50 to the variable. VBScript says, "Oh, we're doing math. I better change the subtype to a numeric one before I do the math, because I can't do math on Strings." This is pretty straightforward. What isn't so straightforward is that it chose the Double subtype instead of Long or Integer or Bytes.&lt;br /&gt;&lt;br /&gt;We may never know the exact reason why VBScript chooses a Double in this situation, but it is probably a prevention measure. Other than the Decimal subtype, which is rarely used and only then for extremely large or extremely small number, the Double subtype is the most capable of holding large numbers. Rather than go to the trouble of figuring out the result of the math first, and then deciding on a subtype, VBScript just picks the most accommodating subtype, Double, so that it can be reasonably sure that the result of the math will fit in the variable. In other words, VBScript makes the safest choice.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/subtype-change.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2476904894286887191?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2476904894286887191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2476904894286887191' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2476904894286887191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2476904894286887191'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/double-subtype-two.html' title='Double Subtype - TWO'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8746601192440884050</id><published>2008-08-30T04:33:00.000-07:00</published><updated>2008-08-30T04:36:40.910-07:00</updated><title type='text'>Double Subtype - ONE</title><content type='html'>Din lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;MsgBox "TypeName After InputBox: " &amp;amp; TypeName(lngAge)&lt;br /&gt;If IsNumeric(lngAge) Then&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "TypeName after Adding 50: " &amp;amp;TypeName(lngAge)&lt;br /&gt;MsgBox "In 50 years you will be  " &amp;amp; lngAge &amp;amp; "years old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;However, does it really matter that VBScript coerced the variable into Double instead of a Long? There are both numeric subtypes, and the math has exactly the same result. Why care? Well, it's not the end of the world, except that the Double subtype theoretically takes a little bit more processing power than the Long, because the Double is a floating point, numeric subtype (floating point numbers require a greater degree of accuracy, and therefore the processor has to work a little harder to ensure that accuracy). If you were explicitly coercing the subtype, as in the code I started with, you might not choose the Double, because the Double is generally only used for very large or small numbers. You might choose Integer, or Long, or even Byte. That said, sometimes you need to care what the subtype is because you are planning to pass the variable to a method of a COM object that expects an explicit subtype.&lt;br /&gt;&lt;br /&gt;The point of this little exercise is not to debate one numeric subtype is better than another, rather to illustrate implicit type coercion. VBScript automatically knew that we wanted the value the variable to be a number.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/double-subtype-two.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8746601192440884050?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8746601192440884050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8746601192440884050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8746601192440884050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8746601192440884050'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/double-subtype-one.html' title='Double Subtype - ONE'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5854696557481329438</id><published>2008-08-30T04:32:00.001-07:00</published><updated>2008-08-30T04:35:14.450-07:00</updated><title type='text'>Second Call TypeName ( ) Function</title><content type='html'>Din lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;MsgBox "TypeName After InputBox: " &amp;amp; TypeName(lngAge)&lt;br /&gt;If IsNumeric(lngAge) Then&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "TypeName after Adding 50: " &amp;amp;TypeName(lngAge)&lt;br /&gt;MsgBox "In 50 years you will be  " &amp;amp; lngAge &amp;amp; "years old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;The second call to the TypeName ( ) function comes after we add 50 to it, and shows that the subtype is Double. Wait a minute - Double? Why Double? Why not once of the whole number subtypes, such as Integer or Long? I didn't introduce any decimal places in this math? Why would VBScript implicitly coerce the subtype into Double? The answer is because VBScript determined that this was the best thing to do. Since we did not use a conversion function to explicitly tell VBScript to change the variable to one subtype or another, it evaluated the situation and chose the subtype that it thought was best. You have to be careful, because it can be tricky to predict exactly which subtype VBScript will choose.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/double-subtype-one.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5854696557481329438?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5854696557481329438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5854696557481329438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5854696557481329438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5854696557481329438'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/second-call-typename-function.html' title='Second Call TypeName ( ) Function'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6810317591396918792</id><published>2008-08-30T04:30:00.000-07:00</published><updated>2008-08-30T04:33:31.151-07:00</updated><title type='text'>First Call TypeName ( ) Function</title><content type='html'>Din lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;MsgBox "TypeName After InputBox: " &amp;amp; TypeName(lngAge)&lt;br /&gt;If IsNumeric(lngAge) Then&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "TypeName after Adding 50: " &amp;amp;TypeName(lngAge)&lt;br /&gt;MsgBox "In 50 years you will be  " &amp;amp; lngAge &amp;amp; "years old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;The first call to the TypeName ( ) function shows that the subtype is String. That is because data coming back form the InputBox function is always treated as String data, even when the user types in a number. Remember that the String subtype can hold just about any kind of data. However, when number and dates and Boolean True/False values are stored in a variable with the String subtype, they are not treated simple as strings of text with no special meaning. This is why, when our code tries to do math on the String value, VBScript must first coere the subtype to a numeric one.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/implicit-type-coercion.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/second-call-typename-function.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6810317591396918792?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6810317591396918792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6810317591396918792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6810317591396918792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6810317591396918792'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/first-call-typename-function.html' title='First Call TypeName ( ) Function'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-372761353482761628</id><published>2008-08-30T04:28:00.000-07:00</published><updated>2008-08-30T04:32:06.402-07:00</updated><title type='text'>Implicit Type Coercion</title><content type='html'>Implicit type coercion is when a Variant variable changes its subtype automatically. Sometimes, this can work in your favor, and sometimes it can present a problem.&lt;br /&gt;&lt;br /&gt;He is a code that asks the user for his age:&lt;br /&gt;&lt;br /&gt;Dim lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;If IsNumeric(ingAge) Then&lt;br /&gt;lngAge = CLng(lngAge)&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "In 50 years, you will be " &amp;amp; CStr(lngAge) &amp;amp; " years Old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Notice how we use the CLng ( ) and CStr ( ) functions to explicitly coerce the subtype. Well, in the case of this particular code, these functions are ot strictly necessary. The reason is that VBScript's inplicit type coercion would have done approximately the same thing for us. Here is the code again, without the conversion functions.&lt;br /&gt;&lt;br /&gt;Dim lngAge&lt;br /&gt;lngAge = InputBox("Plese enter your age in years")&lt;br /&gt;If IsNumeric(ingAge) Then&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "In 50 years, you will be " &amp;amp; lngAge &amp;amp; " years Old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Because of implicit type coercion, this code works the same way as the original code. Take a look at the fifth line. We did not explicitly coerce the subtype to Long, but the math still works as you would expect. Let us run the same code, but with some TypeName ( ) functions thrown in so that we can watch the subtypes change.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/first-call-typename-function.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-372761353482761628?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/372761353482761628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=372761353482761628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/372761353482761628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/372761353482761628'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/implicit-type-coercion.html' title='Implicit Type Coercion'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1535053956558032134</id><published>2008-08-28T05:28:00.000-07:00</published><updated>2008-08-28T05:29:38.350-07:00</updated><title type='text'>Is Functions - IsDate</title><content type='html'>Dim datBirth&lt;br /&gt;datBirth = InputBox("Please enter the date on which you were born")&lt;br /&gt;If IsDate(datBirth) Then&lt;br /&gt;datBirth = CDate(datBirth)&lt;br /&gt;MsgBox "You were born on day " &amp;amp; Day(datBirth) &amp;amp; _&lt;br /&gt;" of month "&amp;amp; Month (datBirth) &amp;amp; " in the year " &amp;amp; _&lt;br /&gt;year(datBirth) &amp;amp; "."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid date."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Day ( ), Month ( ), and year ( ) are built-in VBScript functions that you can use to return the different parts of a date. Not however, that not all of the "Is" functions work strictly on the values, as IsNumeric ( ) and IsDate ( ) do. The function IsEmpty ( ), IsNull ( ), and IsObject ( ) examine the subtype of the variable, not the value.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1535053956558032134?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1535053956558032134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1535053956558032134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1535053956558032134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1535053956558032134'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/is-functions-isdate.html' title='Is Functions - IsDate'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3200886036570429430</id><published>2008-08-28T05:26:00.000-07:00</published><updated>2008-08-28T05:30:48.735-07:00</updated><title type='text'>Is Functions - IsNumeric</title><content type='html'>You can often get around Type Mismatch errors by using Is Functions. For example here is a code that asks the user his age. Since we don't have any control over what the user types in, we need to varify that he actually typed in a number:&lt;br /&gt;&lt;br /&gt;Dim lngAge&lt;br /&gt;lngAge = InputBox("Please enter your age in years")&lt;br /&gt;If IsNumeric(lngAge) Then&lt;br /&gt;lngAge = CLng(lngAge)&lt;br /&gt;lngAge = lngAge + 50&lt;br /&gt;MsgBox "In 50 years, you will be " &amp;amp; CStr(lngAge) &amp;amp; " years old."&lt;br /&gt;Else&lt;br /&gt;MsgBox "Sorry, but you did not enter a valid number."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Notice how we use the IsNumeric ( ) function to test whether or not the user actually entered a valid number. Since we're palnning to use the CLng ( ) function to coerce the subtype, we want to avoid a Type Mismatch error. What we have not stated explicitly is that the subtype of the variable does not have to be numeric in order for IsNumeric ( ) to return true. IsNumeric ( ) examines the actual value of the variable, rather than its subtype. The subtype of the variable and the value of the variable are two different things. The behavior is actually what allows us to use IsNumeric ( ) to avoid a Type Mismatch error. If IsNumeric ( ) examined the subtype, it would not work as we have been using it. In line three of the above example, the subtype of the lngAge variable is String, yet IsNumeric ( ) returns True if the variable has a number in it. That is because IsNumeric ( ) is considering the value of lngAge, not the subtype. We can test the value before trying to convert the variable's subtype to a different subtype. The function IsDate ( ) works in exactly the same way.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/is-functions-isdate.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3200886036570429430?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3200886036570429430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3200886036570429430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3200886036570429430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3200886036570429430'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/is-functions-isnumeric.html' title='Is Functions - IsNumeric'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2054309210460216326</id><published>2008-08-28T05:25:00.001-07:00</published><updated>2008-08-28T05:28:35.385-07:00</updated><title type='text'>Runtime Error - Type Mismatch</title><content type='html'>Often you are not exactly sure what type of data a variable might hold initially, and you need to be sure of what type of data it is before you try to use a conversion function on it. This is because using a conversion function on the wrong type of data can cause a runtime error. For example, try this code:&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = "Hello"&lt;br /&gt;varTest = CLng(varTest)&lt;br /&gt;&lt;br /&gt;This code will cause a runtime error on line 3: "Type Mismatch". Not a nice thing to happen when your code is trying to accomplish something. Obviously, this little code sample is pretty silly, because we knew that the variable contained a String when we tried to convert it to a Long. This is especially true when you are (1) accepting input from a user (2) reading data from a database (3) reading data from a file.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/is-functions-isnumeric.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2054309210460216326?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2054309210460216326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2054309210460216326' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2054309210460216326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2054309210460216326'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/runtime-error-type-mismatch.html' title='Runtime Error - Type Mismatch'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3836307055416363491</id><published>2008-08-28T05:24:00.001-07:00</published><updated>2008-08-28T05:26:33.903-07:00</updated><title type='text'>Forcing Date/Time</title><content type='html'>There are different ways that we can force the subtype to be Date instead of String:&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = #5/16/99 12:30 PM#&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;This example surrounds the date/time value in # signs instead of quotes. This is the VBScript way of identifying a date literal (VB/VBA uses this convention as well). A literal is any value that is expressed directly in your code, as opposed of being expressed via a variable or named constant. The number 12 and the string "Hello There" that I used in previous examples are also literals. By enclosing the date/time in # signs rather than quotes, we are telling VBScript to treat the value as a date, not as a string. As a result when the date literal gets stored in the variant variable, the subtype comes out as Date.&lt;br /&gt;&lt;br /&gt;Here is another example to force date/time instead of String.&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = CDate("5/16/99 12:30 PM")&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;This example uses the CDate ( ) conversion function to achieve the same thing. Once again, the first version is theoretically faster since it does not require an extra function.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/runtime-error-type-mismatch.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3836307055416363491?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3836307055416363491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3836307055416363491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3836307055416363491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3836307055416363491'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/forcing-datetime.html' title='Forcing Date/Time'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4300415372682345172</id><published>2008-08-28T05:22:00.000-07:00</published><updated>2008-08-28T05:25:14.433-07:00</updated><title type='text'>Using Date/Time Values</title><content type='html'>Let us look at a similar example, this time using date/time values.&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = "5/16/99 12:30 PM"&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;When we run this code in Windows Script Host, the variable assignment results in a subtype of String, although you might expect it to be Date. We get the String subtype because we put the date/time value in quotes. We saw this principle in action in another post when we put the number 12 in quotes in the variable assignment.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/forcing-datetime.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4300415372682345172?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4300415372682345172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4300415372682345172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4300415372682345172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4300415372682345172'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/using-datetime-values.html' title='Using Date/Time Values'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5787936998658473369</id><published>2008-08-26T10:23:00.000-07:00</published><updated>2008-08-28T05:24:00.815-07:00</updated><title type='text'>Coercing Variable for Integer Subtype</title><content type='html'>Dim varTest&lt;br /&gt;varTest = 12&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = CInt("12")&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = "12"&lt;br /&gt;varTest = CInt(varTest)&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;All three of these examples achieve the same thing: coercing the varTest variable to have the Integer subtype. The first example results in the Integer subtype because we did not enclose the value 12 in quotes. This tells VBScript that we want the number to be treated as a number, not as text. The second example uses the CInt ( ) conversion function to transform the string value "12" into an Integer value before placing it in the variable. This tells the VBScript that we want the subtype to be Integer right from the start. The third example does the conversion after the fact. Any of these is a valid way to make sure that the value we are placing in the variable is treated as a numeric Integer value. However, the first example might be better because it is theoretically faster because we're not making the extra call to the CInt ( ).&lt;br /&gt;&lt;br /&gt;Note that this code would be redundant:&lt;br /&gt;&lt;br /&gt;Din varTest&lt;br /&gt;varTest = CInt(12)&lt;br /&gt;&lt;br /&gt;Because we don not have quotes around the 12, its subtype will automatically be Integer. However, this code has a different effect:&lt;br /&gt;&lt;br /&gt;Din varTest&lt;br /&gt;varTest = CLng(12)&lt;br /&gt;&lt;br /&gt;This tells vbscript to make sure that the subtype of the variable is Long. The same numeric value of 12 is stored in the variable, but instead of being classified as an Integer, it is classified as a Long. This would be significant if you were passing the value to a VB/COM function that requires a Long.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/using-datetime-values.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5787936998658473369?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5787936998658473369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5787936998658473369' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5787936998658473369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5787936998658473369'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/coercing-variable-for-integer-subtype.html' title='Coercing Variable for Integer Subtype'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6155670364696341656</id><published>2008-08-26T10:21:00.001-07:00</published><updated>2008-08-26T10:24:58.386-07:00</updated><title type='text'>Dealing With String Values</title><content type='html'>Dealing with script values such as "Hello There" is generally straightforward - unless your string value looks like a number, as in the following example.&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = "12"&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;Question is that why does the TypeName ( ) function returns "String" when we clearly passed it a numeric value of 12? This is because we placed value 12 in quotes. By placing it in quotes, we told VBScript that we mean for the value to be treated as a number:&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = 12&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = CInt("12")&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = "12"&lt;br /&gt;varTest = CInt(varTest)&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;All three of these examples given above give the same result.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/coercing-variable-for-integer-subtype.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6155670364696341656?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6155670364696341656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6155670364696341656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6155670364696341656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6155670364696341656'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/dealing-with-string-values.html' title='Dealing With String Values'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6930874950652918695</id><published>2008-08-26T10:19:00.000-07:00</published><updated>2008-08-26T10:23:14.205-07:00</updated><title type='text'>Data Type Prefix</title><content type='html'>Therefore, a data type prefix can tell you the programmer (and the other programmers who are reading or modifying your code) what type of data you intend for a variable to hold. In other words, Variant variables can hold any kind of data, but in practice, any given variable should generally only hold one kind of data. This is not an absolute, as there are certainly legitimate circumstances under which you would intend for a variable to be able to hold multiple data types. By placing a placing a data type prefix in front of your variable name, you make it obviously clear what type of data you intend for that variable to hold, even if you intend for it to, or expect that it night need to, hold multiple types of data. Here is a short list of data type prefixes  that are commonly used.&lt;br /&gt;&lt;br /&gt;var - Variant&lt;br /&gt;str - String&lt;br /&gt;int - Integer&lt;br /&gt;lng - Long&lt;br /&gt;byt - Byte&lt;br /&gt;sng - Single&lt;br /&gt;dbl - Double&lt;br /&gt;cur - Currency&lt;br /&gt;obj - Object&lt;br /&gt;bool - Boolean&lt;br /&gt;&lt;br /&gt;The variable prefix is best used when you don't know exactly what type of data might end up in a variable, or when you intend for that variable to hold all kinds of data.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/dealing-with-string-values.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6930874950652918695?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6930874950652918695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6930874950652918695' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6930874950652918695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6930874950652918695'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/data-type-prefix.html' title='Data Type Prefix'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5653487776180024912</id><published>2008-08-26T10:18:00.001-07:00</published><updated>2008-08-26T10:21:04.194-07:00</updated><title type='text'>Data Type Prefix - Hungarian Notation</title><content type='html'>Dim varTest&lt;br /&gt;varTest = "Hello There"&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;You may have noticed that I named the variable in the above example varTest. This might look strange if you have not seen "Hungarian Notation" before. Hungarian Notation defines the practice of placing prefixes in front of variable names in order to convey the data type of the variable, as well as its "scope". It might seem unnecessary to include a data type prefix since VBScript only supports one data type, the Variant. However, data type prefixes for Variant Variables are just as useful and important, or even more so, as they are for languages that support specific data types. This is because Variant Variables can hold virtually any kind of data.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/data-type-prefix.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5653487776180024912?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5653487776180024912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5653487776180024912' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5653487776180024912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5653487776180024912'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/data-type-prefix-hungarian-notation.html' title='Data Type Prefix - Hungarian Notation'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4308778934921765658</id><published>2008-08-26T10:16:00.000-07:00</published><updated>2008-08-26T10:19:25.448-07:00</updated><title type='text'>Placing New Value</title><content type='html'>A Variant variable automatically chooses its subtype whenever you place a new value into it. It does this by examining the value placed into and making its best guess as to what the appropriate subtype is. Sometimes, though, the Variant’s “best guess” is not quite what you expect. However, you can control this by being careful and explicit in your code. Let’s look at some code example that will demonstrate the principles that I have been talking about here.&lt;br /&gt;&lt;br /&gt;Dim varTest&lt;br /&gt;varTest = "Hello There"&lt;br /&gt;MsgBox TypeName(varTest)&lt;br /&gt;&lt;br /&gt;This makes sense. I placed a text (a.k.a. "string") value into the variable varTest, and VBScript appropriately decided that the variable should have the String subtype.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/data-type-prefix-hungarian-notation.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4308778934921765658?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4308778934921765658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4308778934921765658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4308778934921765658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4308778934921765658'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/placing-new-value.html' title='Placing New Value'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2266629920207595790</id><published>2008-08-26T10:15:00.001-07:00</published><updated>2008-08-26T10:17:59.264-07:00</updated><title type='text'>Testing For and Coercing Subtypes</title><content type='html'>There are two built-in VBScript functions that allow you to check what the subtype is for Variant variable. These functions are VerType ( ) and TypeName ( ). These two functions do pretty much the same thing, but VarType ( ) returns a numeric representation of the subtype and TypeName ( ) returns a string representation.&lt;br /&gt;&lt;br /&gt;VBScript also provides some functions that you can use to force (or ‘coerce’) the Variant to have a specific subtype. These conversion functions are especially useful when you need to pass data of a certain data type to a VB/COM object that expects data of a specific data type. This is also useful when you want to ensure that the value stored in a Variant variable is treated in a certain way. For example, the value 12 can be stored in a Variant variable with either a String subtype or one of the numeric subtypes. If you want to make sure that the number 12 is treated as a number, and not a string, you can use the CLng ( ) conversion function to make sure that the subtype is Long and not String.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/placing-new-value.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2266629920207595790?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2266629920207595790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2266629920207595790' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2266629920207595790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2266629920207595790'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/testing-for-and-coercing-subtypes.html' title='Testing For and Coercing Subtypes'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-340037023486858958</id><published>2008-08-26T10:13:00.000-07:00</published><updated>2008-08-26T10:16:29.911-07:00</updated><title type='text'>Another Downside of the Variant</title><content type='html'>Another downside of Variant variables is that you as a programmer must sometimes pay close attention to what the Variant subtype is at any given moment. This is because of something called implicit type coercion, which is what happens when a variant variable changes its subtype automatically. Implicit type coercion occurs when you assign a new value to a Variant variable that is different then the value currently stored within it. The Variant variable “coerces” the subtype into another subtype based on the type of data assigned to it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/testing-for-and-coercing-subtypes.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-340037023486858958?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/340037023486858958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=340037023486858958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/340037023486858958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/340037023486858958'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/another-downside-of-variant.html' title='Another Downside of the Variant'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5788204193443848529</id><published>2008-08-26T10:12:00.001-07:00</published><updated>2008-08-26T10:14:49.721-07:00</updated><title type='text'>Downside of the Variant</title><content type='html'>The flexibility comes at a price, however. One downside of the Variant is that takes up more memory than many of the specific Visual Basic data types. For this reason, Visual Basic developers will normally only choose to declare a variable as a Variant when they specifically what that variable to be able to handle more than one data type. After all, why take up more memory than you have to?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/vbscript-variant.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/another-downside-of-variant.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5788204193443848529?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5788204193443848529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5788204193443848529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5788204193443848529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5788204193443848529'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/downside-of-variant.html' title='Downside of the Variant'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6975302390356168552</id><published>2008-08-26T10:10:00.001-07:00</published><updated>2008-08-26T10:13:26.799-07:00</updated><title type='text'>VBScript: The Variant</title><content type='html'>As I said in another post, the Variant is the only data type supported in VBScript. Programmers in another language who are accustomed to using a language that offers a wide range of data types might find this disconcerting. However, the good news is that the Variant is also very flexible. Because of the Variant’s ability to store many different data types, your script can handle just about any kind of data you need: numbers, strings (text), and dates, plus other more complex data types such as objects and arrays.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/downside-of-variant.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6975302390356168552?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6975302390356168552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6975302390356168552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6975302390356168552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6975302390356168552'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/vbscript-variant.html' title='VBScript: The Variant'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5820987988458262516</id><published>2008-08-24T10:31:00.001-07:00</published><updated>2008-08-24T10:31:48.478-07:00</updated><title type='text'>Late Bound and Early Bound</title><content type='html'>Note that the Object data type is generic and can hold a reference to any kind of object. Object references stored in a variable of the Object data type are said to be late bound, meaning that object’s interface cannot be solved until runtime. Variables and routine parameters can also be declared as a specific object type. Variables of this sort are said to be early bound, meaning that the interface of the object was known at compile time. A late-bound Variant object variable can be passed to a VBScript procedure that uses an early bound parameter. That said, I am not going to be discussing objects in this post.&lt;br /&gt;&lt;br /&gt;Also if you are also familiar with the Visual Basic data types, you may have noticed that I did not include the “fixed length” String data type in our list. This is because fixed length string cannot be stored in a Variant, and I am primarily interested in the data types that can be used as Variant subtypes.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/visual-basic-data-types.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5820987988458262516?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5820987988458262516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5820987988458262516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5820987988458262516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5820987988458262516'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/late-bound-and-early-bound.html' title='Late Bound and Early Bound'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5705983632002276757</id><published>2008-08-24T10:29:00.000-07:00</published><updated>2008-08-24T10:32:46.627-07:00</updated><title type='text'>Importance of Data Type</title><content type='html'>The data type is also important for another reason: certain types of operations can only be performed on certain data types. For example, before you can perform addition, subtraction, or multiplication on a variable, it must be a numeric data type. This allows the compiler and runtime engine to treat the variable as a number and perform mathematical operations on it. By declaring a variable with one of the numeric data types, you ensure that only numbers will be stored in it, and you can perform mathematical operations on that variable without having to worry about whether the variable actually has a numerical value.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/visual-basic-data-types.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/late-bound-and-early-bound.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5705983632002276757?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5705983632002276757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5705983632002276757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5705983632002276757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5705983632002276757'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/importance-of-data-type.html' title='Importance of Data Type'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6494300564485999532</id><published>2008-08-24T10:28:00.001-07:00</published><updated>2008-08-24T10:31:01.490-07:00</updated><title type='text'>Memory and Data Type</title><content type='html'>A visual Basic variable declared with one of the numeric data types would take up one, two, or four bytes of memory, depending on whether it has the Byte, Integer, or Long data type, respectively. A long variable with a value of 1 takes up the exact same four bytes of memory that a Long variable with a value of 2,000,000 does. What’s difference is the range of numeric values that each of the numeric types can support. Because a Long variable takes up more memory than an Integer variable, larger (and smaller, in the case of negative numbers) can be stored in a Long. The Visual Basic String data type, on the other hand, takes up a different amount of memory depending on how much text is stored in it. A small amount of text (such as the word “Hello”) stored in a String variable would only take up a small amount of memory whereas the string variable with all of Shakespeare’s sonnets stored in it would take up considerably more memory.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/visual-basic-data-types.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/importance-of-data-type.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6494300564485999532?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6494300564485999532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6494300564485999532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6494300564485999532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6494300564485999532'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/memory-and-data-type.html' title='Memory and Data Type'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4125168070446346327</id><published>2008-08-24T10:23:00.000-07:00</published><updated>2008-08-24T10:29:32.346-07:00</updated><title type='text'>Choosing Data Type</title><content type='html'>The first question that needs answering is why a data type is important. Under the hood, data types are important because different data types are stored in different amounts of memory. As a VBScript programmer, you don’t need to be concerned with this sort of detail, but it’s useful to know that one data type might take more or less memory than another, which is one of the reason Visual Basic developers will choose one data type over another – the less memory taken up, the better. Choosing a specific data type is also important to a Visual Basic developer because it helps make the program easier to understand. When you know what data type a variable or parameter is, you also know the limitations on what kind of data is meant to be stored in that variable.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/visual-basic-data-types.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/memory-and-data-type.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4125168070446346327?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4125168070446346327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4125168070446346327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4125168070446346327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4125168070446346327'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/choosing-data-type.html' title='Choosing Data Type'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2569409861216019700</id><published>2008-08-24T10:22:00.001-07:00</published><updated>2008-08-24T10:28:00.735-07:00</updated><title type='text'>What is Variant?</title><content type='html'>The reason is that in order to fully understand the behavior of the Variant, it is essential that you understand that the Variant is merely a ‘container’ for several different data types. Each of the Visual Basic data types that shall be listed later in a post - can be stored inside of the Variant as a subtype. A Variant’s subtype changes automatically depending on what kind of value is stored in it or you can manually set the subtype with one of the VBScript conversion feature. This becomes especially important when your VBScript programs need to interact with COM components that my have been written in VB or another COM-enabled language, such as C++ or Delphi.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/visual-basic-data-types.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/choosing-data-type.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2569409861216019700?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2569409861216019700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2569409861216019700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2569409861216019700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2569409861216019700'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/what-is-variant.html' title='What is Variant?'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-9122219799666582245</id><published>2008-08-24T10:14:00.002-07:00</published><updated>2008-08-24T10:23:42.495-07:00</updated><title type='text'>Visual Basic Data Types</title><content type='html'>Strictly speaking, VBScript only has one data type: the variant. The variant is a special data type that can store many different subtypes. I’ll get to the Variant data type in the next few posts, but first I need to discuss the data types of VBScript’s parent language, Visual Basic. You may be wondering why we need to discuss another language’s data type when VBScript only supports the Variant. This is currently a legitimate question.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/what-is-variant.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-9122219799666582245?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/9122219799666582245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=9122219799666582245' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/9122219799666582245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/9122219799666582245'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/visual-basic-data-types.html' title='Visual Basic Data Types'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5890081690692203788</id><published>2008-08-23T10:22:00.001-07:00</published><updated>2008-08-23T10:22:32.375-07:00</updated><title type='text'>Always Use Comments</title><content type='html'>When writing code, strive to make it self documenting. You can do this by following the guidelines that I gave in related posts. However, self documenting code is elusive quarry. Like the pot of gold at the end of the rainbow, you can never quite reach it, even though it seems to close. The remedy for this is good comment. Most important thing for you to know is that what separates a good comment from a bad comment?&lt;br /&gt;&lt;br /&gt;Generally speaking, a good comment operates at the level of intent. A good comment answers the questions, “What was the programmer trying to do with this code? Where does this code fit in with the overall scheme of the script? Why does this code exist?” The answer to these questions, fill in the blanks that can never be filled by even the best self-documenting code. Good comments are also generally “paragraph-level” comments. Your code should be clear enough that you do not need a comment for every line, but a comment that quickly and clearly describes the purpose for a block of code allows a reader to scan through the comments rather then reading every line of code. The idea is to keep the person who might be reading your code from having to pore over every line to try and figure out why the code exists.&lt;br /&gt;&lt;br /&gt;Bad comments are generally redundant comments, meaning they repeat what the code itself already tells you. Try to make your code as clear as possible so that you don’t need to repeat yourself with comments. Redundant comments tend to add clutter and do more harm then good. Reading the code tells you the ‘how’; reading the comments should tell you the ‘why’.&lt;br /&gt;&lt;br /&gt;Finally, it’s a good idea to get into the habit of adding “tombstone” or “flower box” comments at the top of each file, module, class, and the procedure. These comments typically describe the purpose of the code, the date it was created, the original author, and a log of modification.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5890081690692203788?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5890081690692203788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5890081690692203788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5890081690692203788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5890081690692203788'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/always-use-comments.html' title='Always Use Comments'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8961147203238778218</id><published>2008-08-23T10:20:00.001-07:00</published><updated>2008-08-23T10:24:00.538-07:00</updated><title type='text'>Easy-to-Read Scripting</title><content type='html'>Keep in mind the power that the visual layout of your code has on its clarity. Without reading a single word, you should be able to look at the indentations of the lines to see which ones are subordinate to others. Keep related code together by keeping them on consecutive lines. Separate blocks of unrelated code by putting a blank line between them. Even though the script engine will let you avoid putting multiple statements on the same line.&lt;br /&gt;&lt;br /&gt;Use the line continuation character ( _ ) to break long lines into multiple shorter lines. The importance of a clean layout that visually suggests the logic of the code cannot be overemphasized.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/always-use-comments.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8961147203238778218?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8961147203238778218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8961147203238778218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8961147203238778218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8961147203238778218'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/easy-to-read-scripting.html' title='Easy-to-Read Scripting'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1311289691014037131</id><published>2008-08-23T10:19:00.001-07:00</published><updated>2008-08-23T10:21:45.950-07:00</updated><title type='text'>Multiple Purpose Variable</title><content type='html'>This is a common mistake of beginner and experienced programmers alike to use one variable for multiple purposes, but the fact that experienced programmers might have a bad habit does not make it any less bad. Each variable in your script should have exactly one purpose. It may be tempting to just declare a couple of generic variables with fuzzy names, and then use them for multiple purposes throughout your script – but don’t do it! This is one of the best ways to introduce very strange, hard to track down bugs into your scripts. Giving a variable a good name that clearly defines its purpose will help prevent you from using it for multiple purposes.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/easy-to-read-scripting.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1311289691014037131?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1311289691014037131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1311289691014037131' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1311289691014037131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1311289691014037131'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/multiple-purpose-variable.html' title='Multiple Purpose Variable'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-295067691639419504</id><published>2008-08-23T10:17:00.001-07:00</published><updated>2008-08-23T10:20:18.073-07:00</updated><title type='text'>Hungarian Variable Naming Convention</title><content type='html'>This is a bit out of scope of this discussion, but it bears mentioning nonetheless. The concept of variable data type will be discussed later. The Hungarian naming convention involves giving variable names a prefix that indicates what the scope and data type of the variable are intended to be. So as not to confuse matters, I have not been using the Hungarian convention in my posts, but you will find that most programmers prefer this convention. Properly used, it makes your programs more clear and easier to read and write.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/multiple-purpose-variable.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-295067691639419504?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/295067691639419504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=295067691639419504' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/295067691639419504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/295067691639419504'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/hungarian-variable-naming-convention.html' title='Hungarian Variable Naming Convention'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2556302849679726637</id><published>2008-08-23T10:16:00.001-07:00</published><updated>2008-08-23T10:19:00.814-07:00</updated><title type='text'>Descriptive Name to Procedures</title><content type='html'>When naming procedures, try to choose a name that describes exactly what the procedure does. If the procedure is a function that returns a value, indicate what the return value is in the function name (for example, GetUserName). Try to use good verb-noun combination to describe firstly, what action the procedure performs, and secondly, what the action is performed on (for example SearchDirectory, MakeUniqueFileName, or LoadSettings). Studies show that, since procedures are generally more complicated than variables, good procedure name tend to be longer than good variable names. Fifteen to thirty characters for a procedure name is perfectly acceptable (they can be a bit longer since you generally don’t type them nearly as much). If you are having trouble giving your procedure a good name, that might be an indication that the procedure is not narrow enough – a good procedure does one thing, and does it well.&lt;br /&gt;&lt;br /&gt;That said, if you are writing scripts for your WebPages that will be downloaded to a user’s browser, it is something necessary to use shorter variable and procedure names. Longer names mean larger files to download. Even if you sacrifice some readability in order to make the file smaller, you can still make an effort to make the names as descriptive as possible.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/hungarian-variable-naming-convention.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2556302849679726637?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2556302849679726637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2556302849679726637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2556302849679726637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2556302849679726637'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/descriptive-name-to-procedures.html' title='Descriptive Name to Procedures'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6807756121127268978</id><published>2008-08-23T10:14:00.000-07:00</published><updated>2008-08-23T10:17:22.907-07:00</updated><title type='text'>Descriptive Name to Variables</title><content type='html'>Giving the elements of your programs good names is one of the most important things you can do to ensure that your code will be readable and easily understood. Primarily, this applies to the names you give to variables and procedures.&lt;br /&gt;&lt;br /&gt;When naming a variable, use a name that will make it clear what that variable is used for. Be careful using abbreviations, especially if you think programmers from other countries might need to read your code. Don’t make variable names too short, but don’t make them too long either (studies have shown that ten to sixteen characters is a good length, but ideal length is largely a matter of preferences). Even though VBScript is not case-sensitive, use mixed case (for example, UserName) to make it easier to distinguish multiple words within the variable name.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/descriptive-name-to-procedures.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6807756121127268978?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6807756121127268978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6807756121127268978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6807756121127268978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6807756121127268978'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/descriptive-name-to-variables.html' title='Descriptive Name to Variables'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5328523119980423122</id><published>2008-08-23T10:13:00.001-07:00</published><updated>2008-08-23T10:15:57.305-07:00</updated><title type='text'>Modularize Code</title><content type='html'>When you are writing code, you should constantly evaluate whether any given block of code might be better if you moved it to its own function or sub-procedure. Is the code you’re working on rather complex? Break it into procedures. Are you using lots of Ands and Ors in an If…End If statement? Consider moving the evaluation to its own procedure. Are you writing a block of code that you think you might need again some other part of the script, or in another script? Move it to its own procedure. Are you writing some code that you think someone else might find useful? Move it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/descriptive-name-to-variables.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5328523119980423122?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5328523119980423122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5328523119980423122' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5328523119980423122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5328523119980423122'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/modularize-code.html' title='Modularize Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2143968218804113078</id><published>2008-08-23T10:11:00.000-07:00</published><updated>2008-08-23T10:14:33.544-07:00</updated><title type='text'>Favor Explicit Over Implicit</title><content type='html'>When you are writing code, constantly ask yourself, “Is my intent clear to someone reading this code? Does the code speak for itself? Is there anything mysterious here? Are there any hidden meanings?” Even though something is obvious in your mind at the moment you are typing in the code, that does not mean that it will be obvious to you six months from now, or to someone else tomorrow. Strive to make your code self-documenting, and where you fall short of that goal (which even the best programmers do – self-documenting code can be an elusive goal), use good comments to make things more clear.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/modularize-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2143968218804113078?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2143968218804113078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2143968218804113078' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2143968218804113078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2143968218804113078'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/favor-explicit-over-implicit.html' title='Favor Explicit Over Implicit'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3585661191965823189</id><published>2008-08-23T10:10:00.001-07:00</published><updated>2008-08-23T10:13:06.715-07:00</updated><title type='text'>Expect the Unexpected</title><content type='html'>Always remember that anything can and will happen. Code defensively. You don’t need to obsess over contingencies and remote possibilities, but you can’t ignore them either. You especially have to worry about the unexpected when receiving input from the user, from a database, or from a file. Whenever you’re about to perform an action or something, ask yourself, “What could go wrong here? What happens if the file is flagged Read Only? What happens if the database table does not have any records? What happens if the registry keys I was expecting aren’t there?” If you don’t know what might go wrong with a given operation, find out through research or trial and error. Don’t leave it up to your users to discover how gracefully your script reacts to the unexpected. A huge part of properly preparing for the unexpected is the implementation of proper error handling.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/favor-explicit-over-implicit.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3585661191965823189?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3585661191965823189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3585661191965823189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3585661191965823189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3585661191965823189'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/expect-unexpected.html' title='Expect the Unexpected'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4216596157601140237</id><published>2008-08-23T10:09:00.001-07:00</published><updated>2008-08-23T10:11:37.886-07:00</updated><title type='text'>Programming Guidelines / Techniques</title><content type='html'>It is a really good idea to start adopting good habits right from the beginning. Down the road, you continue to hone your programming skills and even learn multiple languages; these habits will serve you well. Your programs will be easier for you and your fellow programmers to read, understand, and modify, and they will have fewer bugs. When you first get started writing code, you have to concentrate so hard on getting the syntax correct for the computer that its easy to lose sight of the things you need to do to make sure your programs are human friendly as well. However, diligence in this area will pay big dividends:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/expect-unexpected.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4216596157601140237?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4216596157601140237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4216596157601140237' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4216596157601140237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4216596157601140237'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/programming-guidelines-techniques.html' title='Programming Guidelines / Techniques'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6541173112279180565</id><published>2008-08-23T03:10:00.000-07:00</published><updated>2008-08-23T03:12:35.452-07:00</updated><title type='text'>Lahore City</title><content type='html'>Lahore City is the Capital of the Punjab, the largest province of Pakistan by population.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Geography of Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Lahore City is surrounded on the north and west by the Sheikhupra District, on the east by Wagah, on the south by Kasur District. The Ravi River flows on the northern side of Lahore City.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Land Area of Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Lahore City covers a land area of one thousand seven hundred and seventy five square kilometers, which is growing with the passage of time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Population of Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As per Government estimation in 2006, the population of Lahore City was roundabout 10 million, which makes it the second largest city in Pakistan. It is thought-out to be one of the 30 largest cities of the world.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Climate of Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The climate of Lahore City is extreme. The temperatures ascend to 40–45 °C during the months of May, June, and July. Heavy rainfall starts during the month of August. Temperatures can drop to -1 °C during the months of December, January, and February. The city’s maximum temperature ever recorded was 48.3°C, while lowest temperature ever recorded was -6.2°C.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Administrative Towns in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following are the administrative towns of Lahore City.&lt;br /&gt;&lt;br /&gt;Aziz Bhatti Town, Ravi Town, Shalimar Town, Wagah Town, Data Ganj Baksh Town, Gulberg Town, Allama Iqbal Town, Samanabad Town, Nishtar Town, Lahore Cantt, Gulshan-e-Ravi, and Walton Cantt.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Famous Places in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following are some famous places of Lahore City.&lt;br /&gt;&lt;br /&gt;Mall Road, Lahore Zoo, Assembly Hall, Governor House, Anarkali Market, Pace, Hafeez Center, Ichra Bazaar, Mazang, Minar-e-Pakistan, Lahore Museum, Golf Course, Gadhafi Stadium, Jinah Garden, Badshahi Mosque.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Hospitals in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;C.M.H. Hospital, China Hospital, Gulab Devi Hospital, Lahore Medicare Hospital, Punjab Institute Of Cardiology, Wapda Hospital Complex, Ganga Ram Hospital, Gulberg Hospital, Haq Orthopaedic Hospital, Ittefaq Hospital, Lady Willington Hospital, Masood Hospital, Shaukat Kahanum Memorial Hospital, Jinnah Hospital.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Hotels in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Pearl Continental, Mirage Hotel, Holiday Inn City Center, Avari Lahore, Bravo Suits Hotel, Lahore Country Club, The Residency Hotel, Quick Continental Hotel, National Hotel, Ambassador Hotel, Shalimar Hotel, Orient Hotel, Regency Inn Hotel, Hotel Services International.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Libraries in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Dayal Singh Trust Library, Defence Public Library Complex, Environment Data Resource Centre (EDRC), Punjab Public Library, Punjab University Library, Quaid-e-Azam Library.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Parks in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Shalimar Garden, Changa Manga, Jallo Park, Jinnah Garden, Model Town Park. Iqbal Park.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Educational Institutes in Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Lahore University of Management Sciences (LUMS), University of Engineering &amp;amp; Technology (UET), Lahore College for Women University, Hajvery University, Punjab College of Commerce, Government College Lahore, FC College Lahore, The University of Lahore, Punjab University, University of Health Sciences, University of Central Punjab, Science College.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;General Info about Lahore City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Lahore City is famous as the hub of hand-made carpet manufacturing in Pakistan.&lt;/li&gt;&lt;li&gt;Lahore City is one of the most accessible cities of Pakistan.&lt;/li&gt;&lt;li&gt;The Pakistan Railways headquarters is located in Lahore City.&lt;/li&gt;&lt;li&gt;Allama Iqbal International Airport is in Lahore City.&lt;/li&gt;&lt;li&gt;People in Lahore City understand English well and good besides Urdu and Punjabi.&lt;/li&gt;&lt;li&gt;Lahore City is known as the cultural heart of Pakistan.&lt;/li&gt;&lt;li&gt;In Pakistan, Lahore City is famous as ‘the City of Colleges’.&lt;/li&gt;&lt;li&gt;Lahore is known as the City of Gardens.&lt;/li&gt;&lt;li&gt;The most important session of the creation of Pakistan was held in Lahore in 1940.&lt;/li&gt;&lt;li&gt;In 1996, the Cricket World Cup final match was held at the Gaddafi Stadium in Lahore.&lt;/li&gt;&lt;li&gt;Lahore City hosts the country's largest information technology (IT) companies, which accounts for nearly seventy percent of Pakistan's software exports.&lt;/li&gt;&lt;li&gt;Lahore City is the second largest financial hub of Pakistan and has industrial areas including Kot Lakhpat.&lt;/li&gt;&lt;li&gt;World-famous Punjab University is located at Lahore City.&lt;/li&gt;&lt;li&gt;Lahore is the center of Pakistan's media and Arts scene.&lt;/li&gt;&lt;li&gt;Pakistan's film industry is based in the city and is called Lollywood.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6541173112279180565?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6541173112279180565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6541173112279180565' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6541173112279180565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6541173112279180565'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/lahore-city.html' title='Lahore City'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8601354892539317040</id><published>2008-08-23T03:08:00.000-07:00</published><updated>2008-08-23T03:10:15.594-07:00</updated><title type='text'>Karachi City</title><content type='html'>Karachi City is the Capital of Sindh, the south eastern province of Pakistan.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Geography of Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Karachi City is situated in the south of Sindh, on the shoreline of the Arabian Sea. It contains mainly of smooth or rolling plains, with hills on Manora Island and the Oyster Rocks. The Arabian Sea beach shapes the southern coastline of Karachi. Solid mangroves and streams of the Indus delta can be found towards the south east side of the city. Towards the north and the west is Cape Monze located, locally known as Raas Muari, an area marked with projecting sea cliffs and rocky sandstone capes. Some superb beaches can also be found in this region.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Land Area of Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Karachi City extends over an area of three thousand five hundred and fifty square kilometers i.e. one thousand five hundred and sixty six square miles.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Population of Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Karachi City is the biggest city in Pakistan. It is the world's second largest city proper behind Mumbai in terms of the number of residents, which went almost ten million in the year 2002. As per an estimation in 2008, the population of Karachi City is about twelve and a half million. In terms of population, Karachi City is the twentieth largest city of the world. The City’s population is currently growing at about five percent per year.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Climate of Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Situated on the shoreline, Karachi City tends to have a moderately mild climate with low levels of average rainfall (around two hundred and fifty millimeters per annum), the bulk of which occurs during the months of July and August. Winters are mild and the summers are hot, however the closeness to the sea maintains moisture levels at a near-constant high and cool sea breezes reduce the heat of the summer months. Due to high level of warmth during the summer (ranging from thirty to forty four degrees Celsius from April to August), the winter months (November to February) are usually considered the best times to visit Karachi City. July, December and January have pleasant and gloomy weather. Highest ever recorded temperature of Karachi city is 47.8 °C (118.0 °F) and lowest is 5.0 °C (41.0 °F).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Towns in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following are the names of towns in Karachi City.&lt;br /&gt;&lt;br /&gt;Baldia Town, Bin Qasim Town, Gadap Town, Saddar Town, Shah Faisal Town, Gulberg Town, Gulshan-e-Iqbal Town, Jamshed Town, Keamari Town, Korangi Town, North Nazimabad Town, New Karachi Town, Orangi Town, SITE Town, Landhi Town, Liaquatabad Town, Lyari Town, and Malir Town.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Famous Places in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following are some of the famous places in Karachi City.&lt;br /&gt;&lt;br /&gt;National Museum of Pakistan, Pakistan Air Force Museum, Pakistan Maritime Museum, Sindh High Court, Sindh Assembly Hall, Karachi Port Trust (Old building), Governor House, Cape Mount, Clifton Beach, French Beach, Hawke's Bay, Kinara Beach, Manora Beach, Paradise Point, Russian Beach, Bohri Bazar, Bolton Market, Chanti Lane, Empress Market, Hyderi Market, Jama Cloth Market, Jodia Bazar, Kaghzi Bazar, Kapra Market, Area 51 Bowling Club, Beach View Club, City Sports Complex, Creek Club, Defence Authority Club, Golf Club Sea View, Hockey Club of Pakistan, KCCA Cricket Ground, KPT Sports Complex,&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Hospitals in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Labtest Hospital, Combined Military Hospital, Jinnah Postgraduate Medical Centre, National Institute of Cardiovascular Diseases, National Institute of Child Health, PNS Rahat, Karsaz, PNS Shifa, Shoukat Omer Memorial Hospital, Civil Hospital, Civil Hospital (Burns Centre), Nazimabad Chest Clinic, Ojah Institute of Chest Diseases, Police Hospital, Sindh Government Children Hospital, Sindh Institute of Skin Diseases, Sindh Institute of Urology and Transplantation (SIUT), Skin &amp;amp; Social Hygiene Centre, Social Security Hospital.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Hotels in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Avari Towers Hotel, Beach Luxury Hotel, Carlton Hotel, Days Inn, Embassy Inn, Hotel Faran, Hotel Mehran, Marriott Hotel, Pearl Continental Hotel, Ramada Plaza - Airport Hotel, Sheraton Hotel &amp;amp; Towers, Grand Mercure Hotel, Dream World Hotel &amp;amp; Resorts.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Libraries in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Al-Huda Library, Al-Firdous Baldia Public Library, Allama Iqbal Library, Board of Intermediate Karachi Library, Baba-e-Urdu Kutubkhana, Children Library, Faiz-e-Aam Library, Faran Club Library, Ghalib Library, Hashim Gazder Library, Hungooraabad Library, Ibrahim Ali Bhai Auditorium &amp;amp; Library, Iqbal Shaheed Library, Iqra Library, Jehangir Park Reading Room Library, KMC Library, Liaquat National Memorial Library, Lyari Municipal Library, Lyari Text Book Library, Mansoora Library, Moosa Lane Reading Room Library, Moulana Hasrat Mohani Library, Mujahid Park Library, National Book Foundation Library.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Parks in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Aisha Park, Askari Park, Aziz Bhatti Park, Bagh Ibne Qasim, Frere Hall gardens, Beach View Park, Boat Basin Park, Coconut Park, Nishtar Park, Talimi Bagh, Nisar Shaheed Park, Zam Zam Park, Quaid-e-Azam Park, Quaid Mausoleum park.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Educational Institutes in Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Aga Khan University, Baqai Medical University, Dadabhoy Institute of Higher Education, DHA Suffa University, FAST-National University of Computer and Emerging Sciences, Fatima Jinnah Dental College, Greenwich University, Hamdard University, Indus Institute of Higher Education, Indus Valley School of Art and Architecture, Institute of Business &amp;amp; Technology, Institute of Business Management, Iqra University, Jinnah University for Women, Karachi Institute of Economics &amp;amp; Technology, Khadim Ali Shah Bukhari Institute of Technology (KASB), Meharban Jogari University, Mid asia Institute of Science &amp;amp; Technology, Mohammad Ali Jinnah University, Nazeer Hussain University, Pakistan Navy Engineering College, Shaheed Zulfikar Ali Bhutto Institute of Science &amp;amp; Technology, Sir Syed University of Engineering &amp;amp; Technology, Textile Institute of Pakistan, Ziauddin Medical University.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;General Info about Karachi City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Karachi City is Pakistan's premier center of banking, industry, and trade.&lt;/li&gt;&lt;li&gt;Karachi City is the financial and commercial capital of Pakistan.&lt;/li&gt;&lt;li&gt;Karachi City serves as a major hub of higher education in South Asia, and the wider Islamic World.&lt;/li&gt;&lt;li&gt;Karachi City was the original capital of Pakistan until the construction of Islamabad City.&lt;/li&gt;&lt;li&gt;Founder of Pakistan, Mohammad Ali Jinnah, was born in Karachi City.&lt;/li&gt;&lt;li&gt;Karachi City claims highest per capita income in South Asia.&lt;/li&gt;&lt;li&gt;Most of Pakistan's public and private banks are headquartered on Karachi City.&lt;/li&gt;&lt;li&gt;Largest Stock Exchange of Pakistan is in Karachi City.&lt;/li&gt;&lt;li&gt;Branches of world-famous motor companies are in Karachi City.&lt;/li&gt;&lt;li&gt;Karachi City has one hundred and seventy eight union councils.&lt;/li&gt;&lt;li&gt;Jinnah International Airport is the largest and busiest airport of the country and is located in Karachi City.&lt;/li&gt;&lt;li&gt;Port of Karachi and the Port Qasim are the largest shipping ports of Pakistan and are located in Karachi City.&lt;/li&gt;&lt;li&gt;Karachi City is the one of the most rapidly growing cities in the world.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8601354892539317040?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8601354892539317040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8601354892539317040' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8601354892539317040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8601354892539317040'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/karachi-city.html' title='Karachi City'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-9138473249372190438</id><published>2008-08-23T03:06:00.000-07:00</published><updated>2008-08-23T03:07:47.897-07:00</updated><title type='text'>Quetta City</title><content type='html'>Quetta City is the Capital of the Balochistan, the largest province of Pakistan by land area.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Geography of Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quetta city consists of a valley and is a natural fort, delimited as it is by grand hills on all sides. The surrounding hills have the booming names of Chiltan, Zarghun, Takatoo and Murdar, encircled by three different mountain ranges. Quetta City is north west of Karachi and Hyderabad, and south west of Islamabad and Rawalpindi. Quetta City is situated at an altitude of seventeen to nineteen hundred meters above sea level.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Land Area of Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quetta City has a land area of two thousand six hundred and fifty square kilometers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Population of Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As per non-governmental census in 2007, the population of Quetta City was approximately 7.6 million including 1.6 million Afghan immigrants. Population mostly consists of Pashto speaking people.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Climate of Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The climate of Quetta City is dry, and mountain air is energizing. Winter starts from the month of November and ends in the month of February. Snowfall is light, though it is not odd to have one in March. Quetta City has minimum winter temperatures ranging well below freezing point and as low as -18˚C. Conveniently the educational institutes are closed in winter due to temperature below freezing point. Quetta City can show off the best spring and autumn in Pakistan. Although summers are warm, the maximum temperature hardly exceeds 32 degrees Celsius (90 degrees Fahrenheit). The evenings are very pleasant, distinguished by a cool breeze that springs to life an hour or two after sunset. Fans are necessary during May and August. Quetta City does not have a rich rainy season during monsoon time. However, it rains during winter.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Towns in Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quetta City has several small housing areas, few of which are following.&lt;br /&gt;&lt;br /&gt;Gulistan Town, Quetta Cantt, Satellite town, Jinnah Town, Samugli Housing Scheme.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Notable Places Near Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Following are some famous places near Quetta City.&lt;br /&gt;&lt;br /&gt;Pishin Valley, Hanna lake, Askari Park, Hazarganji Chiltan National Park.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Hospitals in Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Children Hospital, Civil Hospital, Bolan Medical Complex Hospital, Lady Dufferin Hospital , Helper's Eye Hospital , Fatima Jinnah T.B. Sanitorium, Cenar Hospital.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Hotels in Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Quetta Serena, Fabbs Hotel, Bloom Star Hotel, PTDC Taftan, PTDC Ziarat.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Libraries in Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Balochistan University Library, Central Library, Baluchistan Provincial Assembly Library.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main Educational Institutes in Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Balochistan Institute of Technology, Dare Arqam School of Islam &amp;amp; Modern Sciences, Balochistan University of Information Technology &amp;amp; Engineering and Management Sciences, Command and Staff College, Sardar Bahadur Khan Women University, University of Balochistan, Pharmacy Department Of Balochistan University, Iqra University, F.G Degree College Quetta Cantt, Model Public School &amp;amp; college, Tameer-i-Nau public college, Government College of Technology Balochistan, Army public school and college, Bolan Medical College Quetta,&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;General Info about Quetta City&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Quetta City is a variation of kwatkot, a Pashto language word, which means ‘fort’.&lt;/li&gt;&lt;li&gt;    Quetta City is a vital marketing and communications centre between Afghanistan and Pakistan.&lt;/li&gt;&lt;li&gt;    Quetta City is famous as the fruit basket of Pakistan.&lt;/li&gt;&lt;li&gt;    Football is very popular among the people of Quetta City.&lt;/li&gt;&lt;li&gt;    Quetta City Airport is the fourth highest airport of Pakistan in terms of altitude.&lt;/li&gt;&lt;li&gt;    Quetta City was first mentioned in the 11th century when it was captured by Mahmud Ghaznawi.&lt;/li&gt;&lt;li&gt;    Quetta City was completely destroyed in an earthquake of 7.1 magnitudes on 31 May 1935.&lt;/li&gt;&lt;li&gt;    Thousands of orchards can be found in Pishin Valley, a valley, 50 km far from Quetta City.&lt;/li&gt;&lt;li&gt;    Quetta City is the ninth largest city of Pakistan by population.&lt;/li&gt;&lt;li&gt;    Quetta City was the outer edge of Qandahar until it was captured by the British in Second Afghan war.&lt;/li&gt;&lt;li&gt;    Quetta City is one of those cities that are mostly visited by tourists from abroad.&lt;/li&gt;&lt;li&gt;    Hazarganji Chiltan National Park, spread over 32500 acres is located 20 km far from Quetta City.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-9138473249372190438?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/9138473249372190438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=9138473249372190438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/9138473249372190438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/9138473249372190438'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/quetta-city.html' title='Quetta City'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7201167702323027093</id><published>2008-08-19T08:00:00.000-07:00</published><updated>2008-08-19T08:01:22.857-07:00</updated><title type='text'>Top-Down Code vs. Event Driven Code</title><content type='html'>We write some code, save it in a script file, and use the Window Script Host to execute the script. The Script Host starts executing at the first line and continues to the last line. If a script file contains some procedure definitions (such as our GetUserName function), then the Script Host will only execute those procedures if some other code calls them. Once the Script Host reaches the last line of code, the lifetime of the script ends.&lt;br /&gt;&lt;br /&gt;To-Down programs are very useful for task-oriented scripts. For example, you might write a script to search your hard drive for all the files with the extension .DOC and copy them to a backup directory. Or you might write a script that gets executed every time Windows starts that randomly chooses a desktop wallpaper bitmap file for the session of Windows. Top-Down programming is perfect for these kinds of scripts.&lt;br /&gt;&lt;br /&gt;Event driven code is different, and is useful in different contexts. As the name implies, event-driven code only gets executed when a certain "event" occurs. Until that event occurs, the code won't get executed. If a given event does not occur during the lifetime of the script, the code associated with the event won't get executed at all. If an event occurs, and there's no code associated with the event at all, the event is essentially ignored.&lt;br /&gt;&lt;br /&gt;Event driven programming is the predominant paradigm in Windows programming. Most Windows programs that you use every day were written n the event driven model. This is because of the graphical nature of Windows programs. In a graphical user interface (GUI), you have all sort of buttons drop-down lists, fields in which to type text, etc. Every time a user clicks a button, chooses an item in a list, or types some text into a field, an event is raised within the script. The person wrote that program may or may not have decided to write code in response to that event.&lt;br /&gt;&lt;br /&gt;When a GUI-based program starts, there is almost always some top-down style code that executes first. This code would do things like connect to a database, prompt the user for a name and password, load some settings from a file or the Windows registry, etc. Then a form typically comes up. The form contains the menus, buttons, lists, and fields that make up the user interface of the program. At that point, the top-down style code is done, and the program enters what is knows as wait state. No code is executing at this point. The program is just sitting there, waiting for the user to do something. From there on in, it's all about events.&lt;br /&gt;&lt;br /&gt;Lets say the user clicks on a button. Now the program comes to life again. The program raises the "Click" event for the button that the user clicked. The code that is attached t the event starts to execute, performs some operations, and when it's finished, the program returns to its wait state. Until another event occurs, the program just sits there.&lt;br /&gt;&lt;br /&gt;As for as VBScript, the event driven model is used in scripting for the World Wide Web. The scripts that run inside of HTML pages are all based on events. One script might execute when the page is loaded. Another script might execute when the user clicks on a  button or graphic. These "mini scripts" are embedded in the HTML file, and are blocked out in a syntax very similar to the one we used to define the GetUserName function in some other posts.&lt;br /&gt;&lt;br /&gt;Let us see an example. Type the following code into your text editor, save the file with a HTML extention, and then select Open from the File menu in Internet Explorer 4.0 or higher to open the file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;#60;html&amp;#62;&lt;br /&gt;&amp;#60;head&amp;#62;&lt;br /&gt;&amp;#60;Script language=&amp;#34;VBScript&amp;#34;&amp;#62;&lt;br /&gt;Sub ButtonClicked&lt;br /&gt;window.alert(&amp;#34;You clicked the button.&amp;#34;)&lt;br /&gt;End Sub&lt;br /&gt;&amp;#60;/Script&amp;#62;&lt;br /&gt;&amp;#60;/head&amp;#62;&lt;br /&gt;&amp;#60;body&amp;#62;&lt;br /&gt;&amp;#60;Button name=&amp;#34;SomeButton&amp;#34; type=&amp;#34;Button&amp;#34; onclick=&amp;#34;ButtonClicked&amp;#34;&gt;&lt;br /&gt;Click Me&lt;br /&gt;&amp;#60;/Button&amp;#62;&lt;br /&gt;&amp;#60;/body&amp;#62;&lt;br /&gt;&amp;#60;/html&amp;#62;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7201167702323027093?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7201167702323027093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7201167702323027093' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7201167702323027093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7201167702323027093'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/top-down-code-vs-event-driven-code.html' title='Top-Down Code vs. Event Driven Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2630025654345325477</id><published>2008-08-19T07:58:00.001-07:00</published><updated>2008-08-19T08:00:24.793-07:00</updated><title type='text'>Third Advantage of Procedures</title><content type='html'>When code is isolated into its own procedure, it greatly reduces the effects of changes to that code. This goes back to the idea of the black box. As long as the procedure itself maintains its predictable inputs and outputs, changes to the code inside of a procedure are insulated from harming the code that calls the procedure. If we decide we don't want to use a loop anymore in the GetUserName function, we can change the code to only ask the user his name once instead of five times. The code that calls the GetUserName function won't care.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2630025654345325477?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2630025654345325477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2630025654345325477' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2630025654345325477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2630025654345325477'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/third-advantage-of-procedures.html' title='Third Advantage of Procedures'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8883620688388231776</id><published>2008-08-19T07:56:00.000-07:00</published><updated>2008-08-19T07:59:54.262-07:00</updated><title type='text'>Second Advantage of Procedures</title><content type='html'>When you call a procedure to perform a task than writing the code "inline," it makes that code easier to read and maintain. Increasing the readability, and therefore the maintainability, of your code is a good enough reason by itself to break a block of code out into its own procedure. Not including the comments and blank lines, the GetUserName function contains 19 lines of code. By taking these 19 lines and moving them to their own procedure, we reduced the code from which we moved it by 19 lines. Less Code + good procedure name = easier to read. If ever you're writing some code that is getting rather long, consider breaking one or more sections of it out into their own functions or sub procedures.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/third-advantage-of-procedures.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8883620688388231776?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8883620688388231776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8883620688388231776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8883620688388231776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8883620688388231776'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/second-advantage-of-procedures.html' title='Second Advantage of Procedures'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4748947285863150576</id><published>2008-08-19T07:55:00.001-07:00</published><updated>2008-08-19T07:58:19.192-07:00</updated><title type='text'>First Advantage of Procedures</title><content type='html'>Code such as the code we put in the GetUserName function can be thought of as "generic," meaning that it can be applied to a variety of uses. Once you have a discreet, well defined, generic function such as GetUserName, you can reuse it any time you wish to prompt the user for their name. Once you've written a well-tested procedure, you never have to write that code again. Any time you need it, you just call the procedure. This is knows as Code Reuse.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/second-advantage-of-procedures.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4748947285863150576?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4748947285863150576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4748947285863150576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4748947285863150576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4748947285863150576'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/first-advantage-of-procedures.html' title='First Advantage of Procedures'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7134262716877655009</id><published>2008-08-19T07:53:00.000-07:00</published><updated>2008-08-19T07:56:46.501-07:00</updated><title type='text'>GetUserName Function</title><content type='html'>Function GetUserName&lt;br /&gt;'Prompts the user for his name. If the user refuses to provide&lt;br /&gt;''his name five times, we give up and return a zero-length string.&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Dim LoopCount&lt;br /&gt;LoopCount = 1&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserNAme)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;If LoopCount &gt; 5 Then&lt;br /&gt;UserName = " "&lt;br /&gt;TryAgain = "No"&lt;br /&gt;Else&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;End If&lt;br /&gt;LoopCount = LoopCount + 1&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;GetUserNAme = UserName&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Finally, notice how, in the second to last line, we treat the function name GetUserName as if it were a variable. When using functions (as opposed to subprocedures, which do not return a value), this is how you give the function its return value. In a sense, the function name itself is a variable within the procedure.&lt;br /&gt;&lt;br /&gt;Let's take a look at some code that uses the GetUserName function.&lt;br /&gt;&lt;br /&gt;Dim Greeting&lt;br /&gt;Din AnyName&lt;br /&gt;AnyName = GetUserName&lt;br /&gt;If Trim(AnyName( &lt;&gt; " " Then&lt;br /&gt;Greeting = "Hello, " &amp;amp; AnyNAme &amp;amp; " Glad to meet you."&lt;br /&gt;Else&lt;br /&gt;Greeting = "I/m glad to meet you, but I wish I knew your name."&lt;br /&gt;End If&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;If you are using the Windows Script Host to execute this code, keep in mind that the above code and the GetUserName function itself must be in the same .vbs file. As you can see, calling the GetUserNAme function is pretty straightforward. Once you have written a procedure, calling it is no different than calling a built-in VBScript procedure.&lt;br /&gt;&lt;br /&gt;Breaking your code into modular procedures is very good habit to pick up.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/first-advantage-of-procedures.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7134262716877655009?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7134262716877655009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7134262716877655009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7134262716877655009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7134262716877655009'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/getusername-function.html' title='GetUserName Function'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6393453167767339450</id><published>2008-08-19T07:52:00.001-07:00</published><updated>2008-08-19T07:55:08.263-07:00</updated><title type='text'>Comment in the Procedure</title><content type='html'>Function GetUserName&lt;br /&gt;'Prompts the user for his name. If the user refuses to provide&lt;br /&gt;'his name five times, we give up and return a zero-length string.&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Dim LoopCount&lt;br /&gt;LoopCount = 1&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserNAme)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;If LoopCount &gt; 5 Then&lt;br /&gt;UserName = " "&lt;br /&gt;TryAgain = "No"&lt;br /&gt;Else&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;End If&lt;br /&gt;LoopCount = LoopCount + 1&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;GetUserNAme = UserNAme&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;We also added a comment to the beginning of the procedure to describe what it does. Notice that the comment does not describe how the function does what it does, only what it does. The code that uses this function does not care how the function accomplishes its task - it only cares about inputs, outputs, and predictability. It is very important that you add comments such as this to the beginning of your procedure, since they make it easy to determine what the function does. This comment also performs one other valuable service to you and any other developer who wants to call this function: it mentions that the function may return an zero-length string if the user does not enter his name. It is important that a programmer knows the possible range of return values so they can right code to deal with those contingencies.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/getusername-function.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6393453167767339450?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6393453167767339450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6393453167767339450' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6393453167767339450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6393453167767339450'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/comment-in-procedure.html' title='Comment in the Procedure'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4166976108812552857</id><published>2008-08-19T07:50:00.000-07:00</published><updated>2008-08-19T07:53:33.440-07:00</updated><title type='text'>Why We Added The Loop Counter?</title><content type='html'>Function GetUserName&lt;br /&gt;'Prompts the user for his name. If the user refuses to provide&lt;br /&gt;''his name five times, we give up and return a zero-length string.&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Dim LoopCount&lt;br /&gt;LoopCount = 1&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserNAme)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;If LoopCount &gt; 5 Then&lt;br /&gt;UserName = " "&lt;br /&gt;TryAgain = "No"&lt;br /&gt;Else&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;End If&lt;br /&gt;LoopCount = LoopCount + 1&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;GetUserNAme = UserNAme&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;The reason we added the loop counter to the code is that our goal is to create a perfect black box. A perfect black box is very predictable as possible. The more predicable it is, the less the code that calls the procedure has to worry about it. If the user is being difficult and does not want to enter his name, we don't want to keep looping around forever., asking again and again. So after asking five times, the function gives up and returns a zero-length string.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/comment-in-procedure.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4166976108812552857?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4166976108812552857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4166976108812552857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4166976108812552857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4166976108812552857'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/why-we-added-loop-counter.html' title='Why We Added The Loop Counter?'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8877824240767398950</id><published>2008-08-19T07:49:00.001-07:00</published><updated>2008-08-19T07:52:00.134-07:00</updated><title type='text'>Code Inside The Function</title><content type='html'>Function GetUserName&lt;br /&gt;'Prompts the user for his name. If the user refuses to provide&lt;br /&gt;''his name five times, we give up and return a zero-length string.&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Dim LoopCount&lt;br /&gt;LoopCount = 1&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserNAme)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;If LoopCount &gt; 5 Then&lt;br /&gt;UserName = " "&lt;br /&gt;TryAgain = "No"&lt;br /&gt;Else&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;End If&lt;br /&gt;LoopCount = LoopCount + 1&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;GetUserNAme = UserNAme&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;The code inside the function is very similar to the code I used in the discussion of loops. I have introduced one new element, though: the LoopCount variable. I am using this variable to count the number of times we go through the loop. Before we start the loop, we initialize LoopCount with the numeric value of zero. Then, at the beginning of each loop, we increment the value of LoopCount by 1. If we go through the loop more than five times without the user entering his name, we stop asking and set the user name to a blank string (represented by " ").&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/why-we-added-loop-counter.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8877824240767398950?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8877824240767398950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8877824240767398950' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8877824240767398950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8877824240767398950'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/code-inside-function.html' title='Code Inside The Function'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4269642022411738742</id><published>2008-08-19T07:47:00.001-07:00</published><updated>2008-08-19T07:50:25.983-07:00</updated><title type='text'>Function Explained</title><content type='html'>Function GetUserName&lt;br /&gt;'Prompts the user for his name. If the user refuses to provide&lt;br /&gt;''his name five times, we give up and return a zero-length string.&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Dim LoopCount&lt;br /&gt;LoopCount = 1&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserNAme)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;If LoopCount &gt; 5 Then&lt;br /&gt;UserName = " "&lt;br /&gt;TryAgain = "No"&lt;br /&gt;Else&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;End If&lt;br /&gt;LoopCount = LoopCount + 1&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;GetUserNAme = UserNAme&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;The first thing to take note of here are the first and last line. The first line defines the beginning of the function and gives it a name. The last line defines the end of the function. Based on our earlier discussion of code blocks, this should be a familiar convention by now. In a sense, a procedure is nothing but a special kind of code block. We have to tell the script engine where it begins, and where it ends. Notice that we have given the function a clear, useful name that precisely described what this function does. Giving your procedure good name is a key to writing programs that are easy to read and maintain.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/code-inside-function.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4269642022411738742?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4269642022411738742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4269642022411738742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4269642022411738742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4269642022411738742'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/function-explained.html' title='Function Explained'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8124137341284733385</id><published>2008-08-19T07:45:00.001-07:00</published><updated>2008-08-19T07:48:49.078-07:00</updated><title type='text'>Procedure and Subprocedure</title><content type='html'>First, though, let's get some terminology straight. "Procedure" is a generic term that can be used to describe either a function or a sub function. I touched some of this confusing terminology earlier, but a function is a procedure that returns a value. Trim ( ) is a function. You pass it some text, and it returns the same text back to you, but with the leading trailing spaces stripped off. Functions do not always require input, but they often do.&lt;br /&gt;&lt;br /&gt;A sub procedure is a procedure that does not return a value. We have been using MsgBox ( ) as a sub procedure in other posts. We pass it some text, and it displays a message on the screen. It does not return any kind of value to our code. All we need to know is that it did what we asked it to do. Like functions, procedure may or may not require input.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/function-explained.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8124137341284733385?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8124137341284733385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8124137341284733385' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8124137341284733385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8124137341284733385'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/procedure-and-subprocedure.html' title='Procedure and Subprocedure'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-749436553353988118</id><published>2008-08-19T07:43:00.000-07:00</published><updated>2008-08-19T07:47:09.462-07:00</updated><title type='text'>Procedure</title><content type='html'>The most basic kind of black box programmers use to achieve modularity is the procedure. A procedure is a set of code that ideally performs a single function. I have used many procedures in previous posts. Some procedures require input, some don't. Some of these procedures return a value, some don't. But all of the procedures I mentioned in other posts (MsgBox ( ), InputBox ( ),, etc.) are black boxes. They perform one single well defined function, and they perform it without your having to worry about how they perform their respective functions.&lt;br /&gt;&lt;br /&gt;Let's move forward to learn how to extend the VBScript language by writing our own procedure.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/procedure-and-subprocedure.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-749436553353988118?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/749436553353988118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=749436553353988118' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/749436553353988118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/749436553353988118'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/procedure.html' title='Procedure'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7453378143240706573</id><published>2008-08-19T07:42:00.001-07:00</published><updated>2008-08-19T07:45:00.097-07:00</updated><title type='text'>Black Box</title><content type='html'>A black box is any kind of device that has a simple, well defined interface and that performs some discrete, well defined function. A black box is so called because you don't need to see what is going on inside of it. All you need to know is what it does, what its inputs are, and sometimes what its outputs are. We encounter black boxes every day. A wrist watch is a good example. A typical watch has some buttons or dials with which you can set the time (the inputs), and a face that you can read to determine the time at any given moment (the out puts). You don't need to know or care how all the gears and gizmos inside the watch are put together in order for the watch to be useful to you. Unless you are an aficionado or collector of watches, you don't really care if it has quartz movement or if there's a small rodent running around inside to keep the watch ticking. It's a black box. All that's important to you are that it works, and that you understand its inputs and outputs.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/procedure.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7453378143240706573?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7453378143240706573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7453378143240706573' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7453378143240706573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7453378143240706573'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/black-box.html' title='Black Box'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1933212129371052592</id><published>2008-08-19T07:40:00.000-07:00</published><updated>2008-08-19T07:43:24.175-07:00</updated><title type='text'>Modularization</title><content type='html'>Modularization is the process of organizing your code into modules., which we can also think of as building blocks. You can apply the principles of modularity to create your own personal set of programming building blocks, which you can then use to build programs that are more powerful, more reliable, and easier for you and your fellow programmers to maintain. When you divide your code into modules, your goal is to create what are known as black boxes.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/black-box.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1933212129371052592?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1933212129371052592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1933212129371052592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1933212129371052592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1933212129371052592'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/modularization.html' title='Modularization'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2028428939235895549</id><published>2008-08-19T07:39:00.000-07:00</published><updated>2008-08-19T07:41:49.691-07:00</updated><title type='text'>Organizing and Reusing Code</title><content type='html'>When you sit down to write a script that will do something useful, chances are your code is going to get a bit more complex. As you add more and more code, it becomes harder and harder to read it all in one chunk. If printed on paper, your script would probably stretch across multiple pages. As the code gets more and more complex, it becomes easier and easier for bugs to creep in, which makes it harder and harder to find and fix those bugs. The most common technique that programmers use to manage complexity is called modularization. That's a big, fancy word, but the concept is simple really.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/modularization.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2028428939235895549?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2028428939235895549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2028428939235895549' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2028428939235895549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2028428939235895549'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/organizing-and-reusing-code.html' title='Organizing and Reusing Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7513963575685374968</id><published>2008-08-18T14:07:00.001-07:00</published><updated>2008-08-18T14:07:59.956-07:00</updated><title type='text'>Your Ability as a Financial Manager</title><content type='html'>If you become a financial manager, your ability to adapt to change, raise funds, invest in assets, and manage wisely will affect the success of your firm and, ultimately, the overall economy as well. To the extent that funds are mis-allocated, this growth of the economy will be slowed. When economic wants are unfulfilled, this mis-allocation of funds may work to the detriment of society. In an economy, efficient allocation of resources is vital to optimal growth in that economy; it is also vital to ensuring that individuals obtain satisfaction of their highest levels of personal wants. Thus, through efficiently acquiring, financing, and managing assets, the financial manager contributes to the firm and to the vitality and growth of the economy as a whole.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/role-of-financial-manager.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7513963575685374968?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7513963575685374968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7513963575685374968' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7513963575685374968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7513963575685374968'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/your-ability-as-financial-manager.html' title='Your Ability as a Financial Manager'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3162585540723426017</id><published>2008-08-18T14:05:00.002-07:00</published><updated>2008-08-18T14:09:13.510-07:00</updated><title type='text'>Impact of External Factors on Financial Manager</title><content type='html'>Today, external factors have an increasing impact on the financial manager. Heightened corporate competition, technological change, volatility in inflation and interest rates, worldwide economic uncertainty, fluctuating exchange rates, tax law changes, and ethical concerns over certain financial financial dealings must be dealt with almost daily. As a result, finance is required to play an ever more vital strategic role within the corporation. The financial manager has emerged as a team player in the overall efforts of a company to create value. The "old ways of doing things" simply are not good enough in a world where old ways quickly become obsolete. Thus, today's financial manager must have the flexibility to adapt to the changing external environment if his or her firm is to survive.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/role-of-financial-manager.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/your-ability-as-financial-manager.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3162585540723426017?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3162585540723426017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3162585540723426017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3162585540723426017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3162585540723426017'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/impact-of-external-factors-on-financial.html' title='Impact of External Factors on Financial Manager'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-451121193574793310</id><published>2008-08-18T14:05:00.001-07:00</published><updated>2008-08-18T14:07:14.685-07:00</updated><title type='text'>Role of a Financial Manager</title><content type='html'>The financial manager plays a dynamic role in a modern company's development . This has not always been the case. Until around the first half of the 1900s financial managers primarily raised funds and managed their firms' cash positions - and that was pretty much it. In the 1950s, the increasing acceptance of present value concepts encouraged financial managers to expand their responsibilities and to become concerned with the selection of capital investment projects.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/impact-of-external-factors-on-financial.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-451121193574793310?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/451121193574793310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=451121193574793310' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/451121193574793310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/451121193574793310'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/role-of-financial-manager.html' title='Role of a Financial Manager'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-4673500625464253572</id><published>2008-08-18T14:00:00.000-07:00</published><updated>2008-08-18T14:01:28.998-07:00</updated><title type='text'>Operator Precedence</title><content type='html'>When more than one operation occurs in an expression they are normally performed from left to right. However, there are several rules.&lt;br /&gt;&lt;br /&gt;Operators from the arithmetic group are evaluated first, then concatenation, comparison and finally logical operators.&lt;br /&gt;&lt;br /&gt;This is the set order in which operators occur (operators in brackets have the same precedence).&lt;br /&gt;&lt;br /&gt;^,-,(*,/),\,Mod,(+,-),&lt;br /&gt;&amp;amp;,&lt;br /&gt;=,&amp;#60;&amp;#62;,&amp;#60;,&amp;#62;,&amp;#60;=,&amp;#62;=,Is,&lt;br /&gt;Not, And, Or, Xor, Eqv, Imp&lt;br /&gt;&lt;br /&gt;This order can be overridden by using parentheses. Operations in parentheses are evaluated before operations outside the parentheses, but inside the parentheses, the normal precedence rules apply.&lt;br /&gt;&lt;br /&gt;If we look at two statements:&lt;br /&gt;&lt;br /&gt;A = 5+6+7+8&lt;br /&gt;A = (5+6) * (7+8)&lt;br /&gt;&lt;br /&gt;According to operator precedence, multiplication is preferred before addition, so the top line gives A the value 55. By adding parentheses, we force additions to be evaluated first and A becomes equal to 165.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/operators.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-4673500625464253572?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/4673500625464253572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=4673500625464253572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4673500625464253572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/4673500625464253572'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/operator-precedence.html' title='Operator Precedence'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8127858411487423862</id><published>2008-08-18T13:59:00.000-07:00</published><updated>2008-08-18T14:03:07.765-07:00</updated><title type='text'>Types of Operators</title><content type='html'>There are different types of operators and they each serve a specific purpose.&lt;br /&gt;&lt;br /&gt;1. The assignment ( = ) operator is the is the most obvious and is simply used for assigning a value to a variable or property.&lt;br /&gt;2. The arithmetic operators are all used to calculate a numeric value, and are normally used in conjunction with the assignment operator and / or one of the comparison operators.&lt;br /&gt;3. The concatenation operators are used to concatenate ("Join together") expressions.&lt;br /&gt;4. The comparison operators are used for comparing variables and expressions against other variables, constants, or expressions.&lt;br /&gt;5. The logical operators are used for comparing variables and expressions against other variables; all logical operators can also be used as bitwise operators.&lt;br /&gt;6. The bitwise operators are used for comparing binary values bit-by-bit; all bitwise operators can also be used as logical operators.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/operators.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/operator-precedence.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8127858411487423862?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8127858411487423862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8127858411487423862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8127858411487423862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8127858411487423862'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/types-of-operators.html' title='Types of Operators'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5474019785286243788</id><published>2008-08-18T13:58:00.001-07:00</published><updated>2008-08-18T14:04:41.444-07:00</updated><title type='text'>Operators</title><content type='html'>An operators acts on one or more operands when comparing, assigning, concatenating, calculating, and performing logical operations.&lt;br /&gt;&lt;br /&gt;Say, you want to calculate the difference between two variables A and B and save the result in variable C. These variables are the operands and to find the difference you use the subtraction operator like this:&lt;br /&gt;&lt;br /&gt;C = A - B&lt;br /&gt;&lt;br /&gt;Here I used the assignment operator ( = ) to assign the difference between A and B, which was found by using the subtraction operator ( - ).&lt;br /&gt;&lt;br /&gt;Operators are one of the single-most important parts of any programming language. Without them, you would not be able to assign values to variables or perform calculations and comparisons! It would be a bit like a bicycle without pedals ...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/types-of-operators.html"&gt;Types of Operators&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/operator-precedence.html"&gt;Operator Precedence&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5474019785286243788?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5474019785286243788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5474019785286243788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5474019785286243788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5474019785286243788'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/operators.html' title='Operators'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-505577493148512163</id><published>2008-08-18T13:53:00.001-07:00</published><updated>2008-08-18T13:55:12.467-07:00</updated><title type='text'>For...Next Loop</title><content type='html'>Now we'll take a quick look at another kind of loop: the For...Next loop. In this kind of loop, we don't need to worry about infinite loops. This is because the loop is predefined to only execute a certain number of times. Here's a simple example:&lt;br /&gt;&lt;br /&gt;Dim Index&lt;br /&gt;MsgBox "Let's count to five. Ready?"&lt;br /&gt;For Index = 1 to 5&lt;br /&gt;MsgBox Index&lt;br /&gt;Next&lt;br /&gt;MsgBox "Wasn't that fun?"&lt;br /&gt;&lt;br /&gt;The beginning loop block is defined by the For statement, and the end is defined by the Next statement. This loop will go around exactly five times. The line For Index = 1 to 5 essentially tells the script engine, "Execute this block of code as many times as it takes to count from 1 to 5, and use the Index variable to keep track of your counting. When we've gone through this code five times, stop looping and move on." Notice that every time the loop goes around (including the first time through), Index equal 1, the second time through it equals 2, and so on up to 5. It's important to note that after the loop is finished, the value of the Index variable will be 6, one number higher than the highest value in our For statement. This occurs because the Index variable is incremented at the end of the loop, after which the For statement tests the value of Index to see if it is necessary to loop again.&lt;br /&gt;&lt;br /&gt;It's difficult to express the real-world usefulness of the For...Next loop without opening a can of worms on a lot of other subjects, but keep in mind that it is often used to traverse some sort of finite piece of data, such as a word, or a text file. For example, the word "elephant" has exactly eight letters. If you first calculate the number of letters in the word "elephant", you could use that number to drive a For...Next loop. Below is a simple example that uses the VBScript Len ( ) function to calculate the length of the word "elephant." Inside the loop, it uses the Mid ( ) function to pull one letter of the word "elephant" at a time.&lt;br /&gt;&lt;br /&gt;Dim Index&lt;br /&gt;Dim WordLength&lt;br /&gt;WordLength = Len("elephant")&lt;br /&gt;For Index = 1 to WordLength&lt;br /&gt;MsgBox Mid("elephant", Index, 1)&lt;br /&gt;Next&lt;br /&gt;MsgBox "elephant"&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-505577493148512163?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/505577493148512163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=505577493148512163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/505577493148512163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/505577493148512163'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/fornext-loop.html' title='For...Next Loop'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6820641120143434917</id><published>2008-08-18T13:51:00.000-07:00</published><updated>2008-08-19T08:53:19.866-07:00</updated><title type='text'>President of Pakistan Pervez Musharraf Resigned</title><content type='html'>Pervez Musharraf, the President of Pakistan, today on the 18th of August 2008, resigned from his presidency because of the extreme pressure of the fear of impeachment by the Democratic Ruling Elite. He was in a state of fear of being given the capital punishment under the Article-6 of the Constitution of Pakistan. The Pakistan's Democratic Ruling Elite had offered him safe passage as a reward of his resignation. Former President of Pakistan, Pervez Musharraf, ruled over Pakistan for approximately nine years by the use of every illegal mean he could. People of Pakistan are dancing with joy and happiness after that Pakistan got rid of a person who is hated every where in the country because of his cruelty and serial killing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6820641120143434917?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6820641120143434917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6820641120143434917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6820641120143434917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6820641120143434917'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/president-of-pakistan-pervez-musharraf.html' title='President of Pakistan Pervez Musharraf Resigned'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-7290512315875384922</id><published>2008-08-18T13:50:00.000-07:00</published><updated>2008-08-18T13:54:43.250-07:00</updated><title type='text'>Loop While in Do...Loop Code</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Do&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TryAgain = "No"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;UserName = "InputBox("Please enter your name:")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;If Trim(UserName) = " " Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;MsgBox "You must enter your name."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TryAgain = "Yes"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Loop While TryAgain = "Yes"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;MsgBox Greeting&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we encounter the end of our loop block. What this Loop line is essentially telling the script engine is "If the TryAgain variable equals "Yes" at this point, then go back up to Do line and execute all that code over again." If the user entered their name, then the TryAgain variable will be equal to "No". Therefore, the code will not loop again, and will continue on to the last line:MsgBox Greeting, which we've seen before.&lt;br /&gt;&lt;br /&gt;If the user did not enter their name, then TryAgain would be equal to "Yes", which would mean that the code would jump back up to the Do line again. This is where the re-initialization of the TryAgain variable to "No" is essential. If we don't reset the value of TryAgain, then there's no way for TryAgain to ever equal anything but "Yes". If TryAgain always equals "Yes", then the loop keeps going around and around forever. This is disaster for your script.=, and for your user.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/fornext-loop.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-7290512315875384922?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/7290512315875384922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=7290512315875384922' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7290512315875384922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/7290512315875384922'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/loop-while-in-doloop-code.html' title='Loop While in Do...Loop Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8376159896294195068</id><published>2008-08-18T13:48:00.000-07:00</published><updated>2008-08-18T13:52:47.962-07:00</updated><title type='text'>Trim Function in Do...Loop Code</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Do&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TryAgain = "No"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;UserName = "InputBox("Please enter your name:")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;If Trim(UserName) = " " Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;MsgBox "You must enter your name."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TryAgain = "Yes"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;End If&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now we are testing our input. The line IF Trim(UserName) = " " Then tests to see if the user typed in their name. If they typed something in, the code immediately after the Else line will execute. If they did not (or if they clicked the Cancel button), then the UserName variable will be empty, and the code after the If line will execute instead. If the user did not type in their name, we display a message informating them that they have done something our script did not like. Then we set the TryAgain variable (our "control" variable) to "Yes". This ensures that the loop will go around again, and then we'll ask the user for their name again.&lt;br /&gt;&lt;br /&gt;If the user did type their name, then we initialize our familiar Greeting variable. Note that in this case, we do not change the value of the TryAgain variable. This is because there is no need to loop around again - the user has obliged us and entered their name. The value of TryAgain is already equal to "No", so there's no need to change it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/loop-while-in-doloop-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8376159896294195068?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8376159896294195068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8376159896294195068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8376159896294195068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8376159896294195068'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/trim-function-in-doloop-code.html' title='Trim Function in Do...Loop Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3342182646180930275</id><published>2008-08-18T13:47:00.001-07:00</published><updated>2008-08-18T13:50:33.018-07:00</updated><title type='text'>Input in Do...Loop Code</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Do&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TryAgain = "No"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;UserName = "InputBox("Please enter your name:")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This should look familiar. We are using the InputBox function to ask the user for their name. We store the return value from the function in the UserName variable. Whatever the user types in, if anything, will be stored in this variable. Put another way, our script is receiving some external input - and remember that I said input is always unpredictable.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/trim-function-in-doloop-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3342182646180930275?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3342182646180930275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3342182646180930275' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3342182646180930275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3342182646180930275'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/input-in-doloop-code.html' title='Input in Do...Loop Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8989754990863811597</id><published>2008-08-18T13:45:00.001-07:00</published><updated>2008-08-18T13:48:32.243-07:00</updated><title type='text'>Control Variable in Do...Loop Code</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Do&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;TryAgain = "No"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here we are initializing our "control" variable . We call it the "control" variable because this variable will ultimately control whether or not the loop loops around again. We want to initialize this variable to "No" so that, by default, the loop will not loop around again. Only if a certain something occurs inside the loop will we set TryAgain to "Yes". This is yet another strategy in our ever-vigilant desire to expect the unexpected.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/input-in-doloop-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8989754990863811597?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8989754990863811597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8989754990863811597' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8989754990863811597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8989754990863811597'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/control-variable-in-doloop-code.html' title='Control Variable in Do...Loop Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6936317038714019872</id><published>2008-08-18T13:43:00.000-07:00</published><updated>2008-08-18T13:46:45.133-07:00</updated><title type='text'>Do in Do...Loop Code</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Do&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This starts the loop. This tells the script engine that we are starting a block of code that will define a loop. The script engine will expect to find a Loop statement somewhere further down in the script. This is similar to the If...End If code block: the script engine expects the block to be defined with beginning and ending statements. I'll get more into this later but take a note the Do statement on a line all by itself means that the loop will execute at least once. Even if the Loop While statement at the end of the block does not result in a loop-around back to the Do line, the code inside this block is going to execute at least one time.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-variable-in-doloop-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6936317038714019872?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6936317038714019872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6936317038714019872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6936317038714019872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6936317038714019872'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/do-in-doloop-code.html' title='Do in Do...Loop Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6944362041029591483</id><published>2008-08-18T13:41:00.001-07:00</published><updated>2008-08-18T13:44:58.372-07:00</updated><title type='text'>Controlling Loop in VBScript</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;We are using the TryAgain variable to control the loop. The loop starts at the word Do. At the End of the loop, if the TryAgaon variable equals "Yes", then the code starting at the word Do will execute again. Notice that at the top of the loop we initialize the TryAgain variable to "No". It is essential that this initialization take place inside the loop (that is, between the Do and Loop statements). This way the variable is re-initialized every time a loop occurs. If we did not do this, we would end up with what's called an infinite loop.&lt;br /&gt;&lt;br /&gt;Infinite loops are undesirable, and whenever you code any kind of loop, you need to take measures to make sure they do not produce an infinite loop. As the term suggests, an infinite loop is one that never stops. Remember that the computer will only do what your script tells it to do. If you tell it to keep looking forever, it will. As long as the loop keeps looping, the code that comes after the loop never gets executed.&lt;br /&gt;&lt;br /&gt;Let us move on to a line by line explanation of the code.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/do-in-doloop-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6944362041029591483?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6944362041029591483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6944362041029591483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6944362041029591483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6944362041029591483'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/controlling-loop-in-vbscript.html' title='Controlling Loop in VBScript'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2333694902168226977</id><published>2008-08-18T13:39:00.001-07:00</published><updated>2008-08-18T13:42:42.233-07:00</updated><title type='text'>Do...Loop</title><content type='html'>First we're going to use the Do...Loop while construct to repeatedly execute a block of code until a certain condition is met. Take a look at this modification of our example script:&lt;br /&gt;&lt;br /&gt;Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;Dim TryAgain&lt;br /&gt;Do&lt;br /&gt;TryAgain = "No"&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = " " Then&lt;br /&gt;MsgBox "You must enter your name."&lt;br /&gt;TryAgain = "Yes"&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;Loop While TryAgain = "Yes"&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;Notice the block of code that starts with the word Do and ends with the line that starts with the word Loop. The indentation should make this code block easy to identify. This is the definition of our loop. The code inside the loop will keep executing until at the end of the loop, the TryAgain variable equals "No".&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/controlling-loop-in-vbscript.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2333694902168226977?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2333694902168226977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2333694902168226977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2333694902168226977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2333694902168226977'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/doloop.html' title='Do...Loop'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1565228124491130317</id><published>2008-08-18T13:37:00.001-07:00</published><updated>2008-08-18T13:40:57.097-07:00</updated><title type='text'>Looping in VBScript</title><content type='html'>Branching in VBScript allows you to tell the script to execute some lines of code, but not others. Looping in VBScript, on the other hand, allows you to tell the script to execute some lines of code over and over again. This is useful in two situations: when you want to repeat a block of code until a condition is True or False, and when you want to repeat a block of code a defined number of times.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/doloop.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1565228124491130317?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1565228124491130317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1565228124491130317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1565228124491130317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1565228124491130317'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/looping-in-vbscript.html' title='Looping in VBScript'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-9042908578036681892</id><published>2008-08-18T03:37:00.001-07:00</published><updated>2008-08-18T03:37:53.248-07:00</updated><title type='text'>End Note</title><content type='html'>Even though branching logic tells the script to execute some lines of code and not others, the code that's not executed must still be interpreted by the script engine. If the code not executed contains syntax errors, the script engine will still produce a syntax error.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-9042908578036681892?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/9042908578036681892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=9042908578036681892' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/9042908578036681892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/9042908578036681892'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/end-note.html' title='End Note'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-3664736344809207399</id><published>2008-08-18T03:36:00.001-07:00</published><updated>2008-08-18T03:39:25.349-07:00</updated><title type='text'>Else If Clause and Nesting</title><content type='html'>If...Else...End If can be extended through the use of the ElseIF clause, and through nesting. Nesting is the technique of placing a block of code inside of another block of code of the same type. The following variation on our script illustrates both concepts:&lt;br /&gt;&lt;br /&gt;Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserName)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;Greeting = "Why won't you tell me your name? That's not very nice."&lt;br /&gt;ElseIf UserName = "go away" Then&lt;br /&gt;Greeting = "That's not very nice."&lt;br /&gt;ElseIf UserName = "who's asking?" Then&lt;br /&gt;Greeting = "I asked you first."&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello, " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;If UserName = "Mike" Then&lt;br /&gt;Greeting = Greeting &amp;amp; " I like the name Mike."&lt;br /&gt;End If&lt;br /&gt;End If&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;Once again, notice how the indenting identifies which lines of code are subordinate to the lines above them.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/end-note.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-3664736344809207399?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/3664736344809207399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=3664736344809207399' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3664736344809207399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/3664736344809207399'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/else-if-clause-and-nesting.html' title='Else If Clause and Nesting'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-2696940409854955244</id><published>2008-08-18T03:34:00.001-07:00</published><updated>2008-08-18T03:37:20.603-07:00</updated><title type='text'>Optional Part of Block</title><content type='html'>The Else part of the block is optional. Sometimes you want to test for a certain condition, and if that condition is True, execute some code - but if it's False, there's no code to execute. For example, we could add another If...End...If block to our script:&lt;br /&gt;&lt;br /&gt;Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;UserName = Trim(UserName)&lt;br /&gt;If UserName = " " Then&lt;br /&gt;Greeting = "Why won't you tell me your name? That's not very nice."&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello, " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;If UserName = "Mike" Then&lt;br /&gt;Greeting = Greeting &amp;amp; " I like the name Mike."&lt;br /&gt;End If&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/else-if-clause-and-nesting.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-2696940409854955244?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/2696940409854955244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=2696940409854955244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2696940409854955244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/2696940409854955244'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/optional-part-of-block.html' title='Optional Part of Block'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-1690633563173038739</id><published>2008-08-18T03:33:00.001-07:00</published><updated>2008-08-18T03:35:45.093-07:00</updated><title type='text'>Human-Reader Aspect</title><content type='html'>The lines of code inside the block are indented four spaces. This is an extremely important concept. It's not important for the script engine that these lines be indented, but for humans who are reading your code, proper indentation is especial. The script engine does not care whether your code has a pleasing appearance, or even that the visual presentation make any sense at all. For example, the following script is completely legal and will execute just fine:&lt;br /&gt;&lt;br /&gt;Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;UserName = InputBox("Please enter your name:")&lt;br /&gt;If Trim(UserName) = "" Then&lt;br /&gt;Greeting = "Why won't you tell me your name? That's not very nice."&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello. " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;This might be fine for the script engine, but it's a nightmare for you and your fellow programmers to make sense of. Generally, you need to indent your code whenever a line or series of lines is subordinate to the lines above and below it. For example, the lines after the IF clause and the Else clause belong inside the If...Else...End If block, so we indent them to visually suggest this.&lt;br /&gt;&lt;br /&gt;This points up a very important programming principle: the presentation of your code should visually suggest its logical structure. In other words, without reading it, we can look at the code and, consciously or unconsciously, getting sense for how it is organized and how it works. By detecting the indentations inside the If...Else...End If block, we can "see" the branching logic at that point in the code, indenting is only one element of programming style, but learning and following styled layout is essential for any programmer who wants to be taken seriously.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/optional-part-of-block.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-1690633563173038739?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/1690633563173038739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=1690633563173038739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1690633563173038739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/1690633563173038739'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/human-reader-aspect_18.html' title='Human-Reader Aspect'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8732762826652062439</id><published>2008-08-18T03:31:00.001-07:00</published><updated>2008-08-18T03:34:28.378-07:00</updated><title type='text'>Block of Code</title><content type='html'>The If...Else...End If construct is what's known as a block of code. A block is a section of code that has a beginning an an end, and usually contains keywords or statement at the beginning and the end. In the case of If...Else...End If, the If statements marks the beginning of the block, and the End If marks the end of the block. The script engine requires these beginning and ending statements, and if you omit them, the engine will not allow your script to execute. You will encounter lots of different code blocks in VBScript. That said, to confuse matters, the term, "block of code" is often used informally to describe any group of lines of code.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/human-reader-aspect_18.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8732762826652062439?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8732762826652062439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8732762826652062439' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8732762826652062439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8732762826652062439'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/block-of-code.html' title='Block of Code'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-8232976356591650357</id><published>2008-08-18T03:28:00.001-07:00</published><updated>2008-08-18T03:32:46.686-07:00</updated><title type='text'>One Line Will Execute</title><content type='html'>So of the user enters nothing (or a string of spaces), then the script will execute this line of code:&lt;br /&gt;&lt;br /&gt;Greeting = "Why won't you tell me you name? That's not very nice."&lt;br /&gt;&lt;br /&gt;Otherwise, it will execute this line of code:&lt;br /&gt;&lt;br /&gt;Greeting = "Hello, " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;&lt;br /&gt;Notice that both lines of code assign a value to the Greeting variable. However, only one of these lines will actually execute. That's because our If...Else...End If block makes an either / or decision. Either a given condition is True, or it is False. It can be both. If it is True, the we'll execute the code between the If and Else statements. If it is False, the we'll execute the code between the Else and End If statements.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/block-of-code.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-8232976356591650357?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/8232976356591650357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=8232976356591650357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8232976356591650357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/8232976356591650357'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/one-line-will-execute.html' title='One Line Will Execute'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-6461196045487495601</id><published>2008-08-18T03:26:00.000-07:00</published><updated>2008-08-18T03:30:35.501-07:00</updated><title type='text'>Trim Function</title><content type='html'>Here's the branching code again:&lt;br /&gt;&lt;br /&gt;UserName = Trim(UserName)&lt;br /&gt;If UserName = "" Then&lt;br /&gt;Greeting = "Why won't you tell me you name? That's not very nice."&lt;br /&gt;Else&lt;br /&gt;Greeting = "Hello, " &amp;amp; UserName &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;We use the Trim () function here to further insulate our script from unpredictability. The Trim () function takes any kind of text as a parameter, and returns the same text, but with any leading or trailing spaces removed. For example, the text "Hello" passed to the Trim () function would come back as just "Hello". We do this just in case the user enters a sequence of one or more spaces, which, for the purpose of our script, is equivalent to not having entered anything. Also notice the double quotation marks (" ") in the line IF Trim (UserName) = "" Then. This is the way to express the "Zero-Length string" that I talked about earlier.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/one-line-will-execute.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-6461196045487495601?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/6461196045487495601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=6461196045487495601' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6461196045487495601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/6461196045487495601'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/trim-function.html' title='Trim Function'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6472893974396894393.post-5938998935868996</id><published>2008-08-18T03:25:00.001-07:00</published><updated>2008-08-18T03:28:14.681-07:00</updated><title type='text'>Absense of Branching Logic</title><content type='html'>Dim Greeting&lt;br /&gt;Dim UserName&lt;br /&gt;UserName = "InputBox("Please enter your name:")&lt;br /&gt;Greeting = "Hello, " &amp;amp; Trim(UserName) &amp;amp; ", it's a pleasure to meet you."&lt;br /&gt;MsgBox Greeting&lt;br /&gt;&lt;br /&gt;This script does not contain any branching logic to test the input, so when the user does something unpredictable, like pressing the Cancel button, or not entering any name at all, the script does not have the ability to adapt. Our non-stupid script adapts to the unpredictability of input by testing it with If...Else...End If branching.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/control-of-flow.html"&gt;First&lt;/a&gt;&lt;br /&gt;&lt;a href="http://musannif.blogspot.com/2008/08/trim-function.html"&gt;Next&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6472893974396894393-5938998935868996?l=musannif.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://musannif.blogspot.com/feeds/5938998935868996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6472893974396894393&amp;postID=5938998935868996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5938998935868996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6472893974396894393/posts/default/5938998935868996'/><link rel='alternate' type='text/html' href='http://musannif.blogspot.com/2008/08/absense-of-branching-logic.html' title='Absense of Branching Logic'/><author><name>Word</name><uri>http://www.blogger.com/profile/10753495389870201295</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
