C
C#8mo ago
Forgatsu

❔ Why it wont let me type array ?

Cant figure it out why im getting this, anyone can explain?
No description
18 Replies
WEIRD FLEX
WEIRD FLEX8mo ago
did jump the code using set next statement? what does test contain there?
Forgatsu
Forgatsu8mo ago
shouldnt it contain strings typed out in it ?
TheRanger
TheRanger8mo 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
WEIRD FLEX
WEIRD FLEX8mo ago
man i missed that, i suspected it tho
Forgatsu
Forgatsu8mo ago
oh i tought 3 means = 4, yk 0,1,2,3
TheRanger
TheRanger8mo ago
not when ur defining a size of the array
Forgatsu
Forgatsu8mo ago
it works now thanks. Been staring for good 10mins couldnt figure out error.
xLelik
xLelik8mo 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
Forgatsu8mo ago
Can i randomize array which is being typed? Like Console.WriteLine(test[Random index 1-3]); ?
Pobiega
Pobiega8mo ago
Yes.
Forgatsu
Forgatsu8mo ago
No description
Forgatsu
Forgatsu8mo ago
i tried this way but seems like im doing something not right xd
Pobiega
Pobiega8mo ago
Google how to get a random number Don't just guess
xLelik
xLelik8mo ago
here is the correct solution
No description
Forgatsu
Forgatsu8mo ago
i did like this
No description
Forgatsu
Forgatsu8mo ago
still not sure what next means but il learn it in future.
Pobiega
Pobiega8mo ago
Next is how you generate a number. It's a method on the class Random
Accord
Accord8mo 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.