-
Notifications
You must be signed in to change notification settings - Fork 0
Instruction 5005 NREPEAT_N
This will REPEAT the previous/next N1 instructions, N2 times.
Arguments:
- N1 - Number (required) -- N last instructions
- N2 - Number (required) -- N times to repeat instructions
- B1 - Bool (required) -- Before (true) or After (false)
- B2 - Bool (optional) (default=true) -- Skip the N1 instructions, before repeating them N2 times
Example N1:
Example N2:
STRING 'OwO '
STRING 'Hello '
STRING 'World'
NREPEAT_N 2 3 <before: true> <skip: true>
OUT_ALL
In the example above, N1 = 2, N2 = 3, Before = true, and Skip = true.
In order, we add OwO
to the stack, but then we Skip over the (N1=2) next instructions, jumping directly to the NREPEAT_N instruction.
So OwO
gets added to the stack immediately, but not the next two strings.
Then we repeat the (N1=2) previous instructions, (N2=3) times.
The instructions above, if we didn't use NREPEAT_N, would look like this:
STRING 'OwO '
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
OUT_ALL
Resulting stack:
Resulting output:
OwO Hello WorldHello WorldHello World
Stack flow:
- Stack:
[ ]
-
STRING:
'OwO '
- Stack:
[ 'OwO ' ]
- NREPEAT_N (N1=2, N2=3, B1=true, B2=true)
- Stack:
[ 'OwO ', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World' ]
STRING 'OwO '
STRING 'Hello '
STRING 'World'
NREPEAT_N 2 3 <before: true> <skip: false>
OUT_ALL
In the example above, N1 = 2, N2 = 3, Before = true, and Skip = false.
In order, we add OwO
to the stack, we DON'T skip over the (N1=2) next instructions.
So OwO
gets added to the stack immediately, and then the next two strings.
Then we repeat the (N1=2) previous instructions, (N2=3) times.
The instructions above, if we didn't use NREPEAT_N, would look like this:
STRING 'OwO '
STRING 'Hello ' -- notice these two are being kept here
STRING 'World' -- , not skipped over
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
OUT_ALL
Resulting stack:
Resulting output:
OwO Hello WorldHello WorldHello WorldHello World
Stack flow:
- Stack:
[ ]
-
STRING:
'OwO '
- Stack:
[ 'OwO ' ]
-
STRING:
'Hello '
- Stack:
[ 'OwO ', 'Hello ' ]
-
STRING:
'World'
- Stack:
[ 'OwO ', 'Hello ', 'World' ]
- NREPEAT_N (N1=2, N2=3, B1=true, B2=false)
- Stack:
[ 'OwO ', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World' ]
STRING 'OwO '
NREPEAT_N 2 3 <before: false> <skip: true>
STRING 'Hello '
STRING 'World'
OUT_ALL
In the example above, N1 = 2, N2 = 3, Before = false, and Skip = true.
In order, we add OwO
to the stack, and then we repeat the (N1=2) next instructions, (N2=3) times.
We then skip (jump over) the next (N1=2) instructions, directly to OUT_ALL, skipping over the two string instructions.
The instructions above, if we didn't use NREPEAT_N, would look like this:
STRING 'OwO '
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
OUT_ALL
Resulting stack:
Resulting output:
OwO Hello WorldHello WorldHello World
Stack flow:
- Stack:
[ ]
-
STRING:
'OwO '
- Stack:
[ 'OwO ' ]
- NREPEAT_N (N1=2, N2=3, B1=false, B2=true)
- Stack:
[ 'OwO ', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World' ]
STRING 'OwO '
NREPEAT_N 2 3 <before: false> <skip: false>
STRING 'Hello '
STRING 'World'
OUT_ALL
In the example above, N1 = 2, N2 = 3, Before = false, and Skip = false.
In order, we add OwO
to the stack, and then we repeat the (N1=2) next instructions, (N2=3) times.
We then execute the next (N1=2) instructions, adding the two strings one more time.
The instructions above, if we didn't use NREPEAT_N, would look like this:
STRING 'OwO '
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
STRING 'Hello '
STRING 'World'
STRING 'Hello ' -- notice these two are being kept here
STRING 'World' -- , not skipped over
OUT_ALL
Resulting stack:
Resulting output:
OwO Hello WorldHello WorldHello WorldHello World
Stack flow:
- Stack:
[ ]
-
STRING:
'OwO '
- Stack:
[ 'OwO ' ]
- NREPEAT_N (N1=2, N2=3, B1=false, B2=false)
- Stack:
[ 'OwO ', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World' ]
-
STRING:
'Hello '
- Stack:
[ 'OwO ', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World', 'Hello ' ]
-
STRING:
'World'
- Stack:
[ 'OwO ', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World', 'Hello ', 'World' ]