Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted
I think this is more a case of coding etiquette. I was taught that you should always try to limit each line to 80 characters, entering long lines across multiple lines.
Posted
I think this is more a case of coding etiquette. I was taught that you should always try to limit each line to 80 characters, entering long lines across multiple lines.

 

I agree with localzuk in this instance, you can use continuation characters to break up the lines to make it more easily readable in print or screen format and yet continue code execution as if it was a single line. I think the VBS one is:

_

Example:
MsgBox "This is the firs tline" & _
"this is the second"

Posted

I'd guess 80 characters is a throwback to punched cards or text mode screens which were 80 characters wide but short lines are easier to read (think newspaper columns).

 

I often do things like:

 

sMsg="this is the first bit of the message"

sMsg=sMsg & " and this is the next bit"

msgbox sMsg

 

which I find easier to read. It's also good when you're building SQL queries - I like to have the select, from, join, order etc bits on separate lines.

Posted

If you are appending lots of different strings together with "string" & "string" it becomes quite slow (comparatively) due to the way that VBS handles string concatenation. The best and fastest way is to use a stringbuilder class to join all of these strings together.

 

For these types of scripts the performance hit is not really important but the more text that you add the more of a problem it can become for the run time.

 

Here is a better write up on it and an example:

15 Seconds : Code Samples : Super Fast String Concatenation

Posted
I'd guess 80 characters is a throwback to punched cards or text mode screens which were 80 characters wide but short lines are easier to read (think newspaper columns).

 

It's all down to unix days really. A standard console is 80 characters wide.

But it is still applicable now really, as reading a 300+ character line is difficult.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...