C
C#14mo ago
Forgatsu

❔ Why it wont let me type array ?

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