Length means length of the resulting string.
So a substring starting at index 1 of length 1 makes perfect sense - it is a single character string with the character at index 1.
With 'C' substring(int StartPos, int EndPos) it is a substring starting at StartPos and ending at EndPos but not including the character at EndPos.
If you did substring(1, 1) then you would get an empty string.
To get a 1 character long string you would need to substring(1, 2) - that is how the segment block is working. So 'length' should be 'endpos'.
Using 'length' as the name of the second parameter is confusing.
So you are trying to loop through a string? Can you explain what you are trying to do and show all your blocks? Still curious about what your debug procedure does.
Peter's explanation is indeed correct,
your block is returning character 0 because it is your first character (not zero as empty).
if you want to use length, use the following block:
Use the tool tip for the segment block, and forget your C expectations.
An easy way to iterate through the letters of a piece of text:
set a local list L to (split input_text at "")
if item 1 of list L is empty text remove it from list L (a peculiarity of the AI2 split block)
for each item in list L
process item (a single letter)
end for each