Skip to content

Interpreter NRE #2262

Description

@DavidObando

I typed the following:

var num =42
func Fib(i int) long -> if i <= 0 { 0 } else if i == 1 { 1 } else { Fib(i-1)+Fib(i-2) }
var numbers map[int, long]

So far so good, then:

for var i = 1; i <= 20; i++ {
  numbers[i] = Fib(i)
}

The result was a GS9999 Object reference not set to an instance of an object

I then realized that I could have done:

var numbers map[int, long] = map[int, long]{}

or simply:

var numbers = map[int, long]{}

but not this:

var numbers map[int, long] = {}

Which results in GS0005: Unexpected token <OpenBraceToken>, expected <IdentifierToken>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions