# VBA Immediate window Byte count

What are the rules for counting bytes in the immediate window? I have found very little in the way of VBA docuimentation to try and help with this, because is seems to be a relatively uncommon golfing language. For clarity, I'm not sure how the rules would be applied in a few test cases below, and would like an explanation of how to count the bytes for these VBA specific examples

If I type into the immediate window, several things are returned, I want to know the byte count of what is returned (prompted by my answer to this question). Here's some specific cases I'm not sure about:

?;


When I enter this, I am put on a new line. Pressing down arrow does nothing, so I assume no bytes are below the cursor. I notice that a space is added after the ;, so I'm guessing the byte count is 1 for the space + 1 for the newline? Or is it customary to not count the extra space?

Meanwhile

?a


That evaluates the constant a, undefined at this point. When entered, the cursor is put 2 lines below the input, rather than immediately below as before. Also, a space is put after the a, and on the intermediate line. So that suggests 2 newlines and 2 spaces = 4 byte output. Also, unlike before, pressing does do something, it takes me onto the next line. So maybe 3 newlines?

Finally

?,


I have no idea what's going on there, does it count as a tab or a load of spaces? Maybe I'm mixing up newlines and spaces, I'm not sure.

## migrated from codegolf.stackexchange.comMay 18 '17 at 12:30

This question came from our site for programming puzzle enthusiasts and code golfers.

• What are you trying to count and why? Normally we care about counting the bytes in your code, for scoring purposes, so I can't understand why you're worried about how many bytes of output you're getting. – Peter Taylor May 18 '17 at 15:09
• @PeterTaylor sometimes output size matters: codegolf.stackexchange.com/questions/121056/… – steenbergh May 18 '17 at 15:10

?; doesn't add a space to the end of the line. When you select all text in the immediate window, it visualises the line-break by adding a bit of space to the end, but it isn't an actual space. Try moving the caret there. The command ?; means PRINT (nothing) and suppress tabs and newlines. Newlines are added automatically by VBA to print statements, except when suppressed with ;. This statement therefore has an output of 0 bytes.
?, means PRINT (nothing), then TAB and print (nothing again). Since newlines are not suppressed, that is also added. In my command window, it seems to add 14 spaces instead of a single tab. I find it hard to score this... I'd go for 2 bytes: tab and newline.
?a says Print the undefined var a (nothing) and is again followed by a newline. Output 1 byte.
• I also can't move the caret over it, but can select it. So to double check, you would say the output of ?; is 1 byte, or still 0 like in your answer since the program doesn't add the extra character, VBA does? – Greedo May 18 '17 at 14:22