String Access problem

Hi community,

I have such a problem:

I have a code such:

var question = 0;
var val1 =“Sıfır”;
var val2 = “Nul”;
var val3 = “Bir”;
Till 405 numbers

And I will random a number:

question = Random.Range(1,405);

And I want to print one of them such as like:


So I want to return the value of for example val2 and the printed one will be “Nul”

But always the returning result is such as “val40”, “val3”… instead of “Sifir”, “Bir”

How can I access the variable in those strings with such an example of this print example?

I will put around 3000 values so is is not a good idea to use if comments that will make my job so hard.

Sorry for my writing that I dont know how to write proper in Answers, and thank you for your help from now

Why dont you use an array for the val declaration,because what you are doing is completely illogical, try something like this

var val : String[];    //declare these values in the inspector 
private var question : int;

function Update()
	if(print)  // your condition to print
		question = Random.Range(0,val.length);
		print("val "+val[question]);