C
C#2y ago
Forgatsu

❔ Why it wont let me type array ?

Cant figure it out why im getting this, anyone can explain?
No description
18 Replies
Ꜳåąɐȁặⱥᴀᴬ
did jump the code using set next statement? what does test contain there?
Forgatsu
ForgatsuOP2y ago
shouldnt it contain strings typed out in it ?
TheRanger
TheRanger2y ago
are u in release mode? the error is in test[3] = "Zolas"; line if ur in debug mode, that line should glow instead anyway the array can only contain 3 elements and u provided 4
Ꜳåąɐȁặⱥᴀᴬ
man i missed that, i suspected it tho
Forgatsu
ForgatsuOP2y ago
oh i tought 3 means = 4, yk 0,1,2,3
TheRanger
TheRanger2y ago
not when ur defining a size of the array
Forgatsu
ForgatsuOP2y ago
it works now thanks. Been staring for good 10mins couldnt figure out error.
xLelik
xLelik2y ago
you created an array with 3 elements, the element numbers start from 0, that is, [0], [1], [2]. You created a non-existent index
Forgatsu
ForgatsuOP2y ago
Can i randomize array which is being typed? Like Console.WriteLine(test[Random index 1-3]); ?
Pobiega
Pobiega2y ago
Yes.
Forgatsu
ForgatsuOP2y ago
No description
Forgatsu
ForgatsuOP2y ago
i tried this way but seems like im doing something not right xd
Pobiega
Pobiega2y ago
Google how to get a random number Don't just guess
xLelik
xLelik2y ago
here is the correct solution
No description
Forgatsu
ForgatsuOP2y ago
i did like this
No description
Forgatsu
ForgatsuOP2y ago
still not sure what next means but il learn it in future.
Pobiega
Pobiega2y ago
Next is how you generate a number. It's a method on the class Random
Accord
Accord2y ago
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.

Did you find this page helpful?