Questionable Dabbling

An unfocused exploration of ‘How’ and ‘Why’

  • You are here: 
  • Home
  • VBScript: Multiple Statements on One Line

VBScript: Multiple Statements on One Line

Many examples have I seen regarding how to break a long statement into multiple lines but only yesterday did I learn how to place two statements on the same line.


DIM strMyName : strMyName = "Chris"
DIM i : For i = 0 to 10
WScript.Echo i
Loop

This is, to me, very cool. If you’re using ‘Option Explicit’ (which you better be using), you can declare and assign a value to a variable, all on the same line… not too exciting, but it makes code much cleaner when used apropriatly.


Posted on August 13th, 2008 | By: Chris | Tags: , ,
Filed under Coding, Scripting, VBScript


6 Responses to “VBScript: Multiple Statements on One Line”

  1. Votey Disciple Says:
    August 14th, 2008 at 10:42 am

    This is why VB .NET was so much more useful.

    Dim strMyName = “Chris”
    For i As Integer = 0 To 10

    End For

  2. Chris Says:
    September 11th, 2008 at 9:05 am

    More powerful, yes. More useful, arguably no. The VBScript engine is part of a Windows install these days. VB.Net compilers, on the other hand, are less prevalent.

  3. Антон Павлович Says:
    March 24th, 2010 at 8:36 pm

    Спасибо

  4. Kylie Batt Says:
    May 3rd, 2010 at 2:09 am

    Улыбнуло спасибо……

    Инженер ……

  5. Kylie Batt Says:
    May 19th, 2010 at 9:45 pm

    Номер не пройдет!…

    емкости Пчеловодство ……

  6. Webmaster Says:
    June 10th, 2010 at 12:03 pm

    Hello! Please e-mail me your contacts. I have a question webmaster@bravto.ru” rel=”nofollow”>……

    Thank you!!!…

Leave a Reply