-
-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels