Skip to content

The unwritten coexistence of integers & arrays namesakes #47

Description

@MaximilianYan

A code

function sum(id, pr, n, a):
	x := array(n)

	x := 1
	x += id

	print(x)
	x := array(n)
	print(10000+x)

	x += id

correctly (without errors being occurred) works with output (e.g., input is 1 239)

1
2
3
...
100
10001
10002
10003
...
10100
steps: 26

.

Meanwhile, a code

function sum(id, pr, n, a):
	x := array(n)
	print(x)

	x := 1
	x += id

	x := array(n)

	x += id

(e.g., input is 1 239) fails with an error

step 3, id 0, line 3: no such variable: x

.

I've found nothing about redeclaration of the variables in the documentation, and such a behavior seems inconsistent to me.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions