❔ I keep getting an error " Index was outside the bounds of the array"
I've written a method that gets 3 arrays, in which the third one has to have all the numbers merged from the first two arrays. Then when I try to check if that works correctly it gives me that error.
$code
22 Replies
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/
( The method )
( The calling code )
( It is known that there is up to numbers with three digits)
Easiest to $debug and check the values yourself
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
But your loop is just too big
oh
What are the limits to the loop? And is there a way to bypass that somehow?
Use the size of the arrays
and if let's say I make an array of a 1000
it will let me?
Sure
I see, thank you!
@phaseshift
I changed the code
still the same error
Time to engage brain a bit.
Are crr, arr, brr all the same size?
arr + brr length must be equal to crr length
Else it's false
oh wait
yeah
nvm
So you're looping over the size of crr
yes
Doing crr[i]
Wait, if like let's say the int[] size is 5
And brr[i]
and I loop till like 8
it will show error?
Yes, of course. That's the point of the error
Oh
omg
Thank you!
👍🏻
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.