Re: Weird error

new topic     » goto parent     » topic index » view thread      » older message » newer message

> Maybe it's just me, but I can't understand this error I'm getting:
> Subscript value 0 is out of bounds, reading from a length 12 sequence
> I'm getting it on this line:
>
> if y1>0 and y1<12 and x>0 then a=barrierow[y1][x+1]

An interpreted language has to parse up its source code line by line
(this is a simplification, but the idea holds). So when the Euphoria
interpreter gets to this line of your code it begins to parse it up. It
replaces variable names with their values, for example. Before it
executes the line of code Euphoria will look for errors. In this case an
error will happen EVEN THOUGH THAT CODE IS NEVER EXECUTED! There are two
steps, you see? 1) Interpret... 2) Execute.

You don't see this in a compiled language, such as C. That is why it is
faster, becuase it skips the "1) interpret" step.

My suggestion is to split this up into multiple lines, like this.

if y1 > 0 and y1 < 12 then
        a = barrierow[y1][x+1]
endif

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu