Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong error: Variable name "i" already defined (check_syntax) [E] #261

Open
Ennowulff opened this issue Feb 15, 2023 · 1 comment
Open

Comments

@Ennowulff
Copy link

Ennowulff commented Feb 15, 2023

The following code leads to the error:
Variable name "i" already defined (check_syntax) [E]

CLASS zcl_demo DEFINITION.

  PUBLIC SECTION.
    METHODS test
      IMPORTING
        word1 TYPE string
        word2 TYPE string
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zcl_demo IMPLEMENTATION.
  METHOD text.

    DATA(word1_table) = VALUE string_table( FOR i = 0 WHILE i < strlen( word1 )
                                        ( substring( val = word1 off = i len = 1 ) ) ).
    DATA(word2_table) = VALUE string_table( FOR i = 0 WHILE i < strlen( word2 )
                                        ( substring( val = word2 off = i len = 1 ) ) ).
  ENDMETHOD.

ENDCLASS.

The second VALUE command uses the same local variable "i" what is accepted by the ABAP compiler.
But it leads to the error in exercism.

@larshp larshp mentioned this issue Feb 15, 2023
@larshp
Copy link
Member

larshp commented Feb 15, 2023

thanks, also see #202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants