Questionable Dabbling

An unfocused exploration of ‘How’ and ‘Why’

  • You are here: 
  • Home
  • VBScript

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.