Как это можно упростить?
Код: Выделить всё
if(section_time_cumulative[0]=time)
{
linears[0]
}
else if(section_time_cumulative[1]=time)
{
linears[1]
}
else if(section_time_cumulative[2]=time)
{
linears[2]
}
else if(section_time_cumulative[3]=time)
{
linears[3]
}
else if(section_time_cumulative[4]=time)
{
linears[4]
}
else if(section_time_cumulative[5]=time)
{
linears[5]
}
else if(section_time_cumulative[6]=time)
{
linears[6]
}
else if(section_time_cumulative[7]=time)
{
linears[7]
}
else
{
0
}

Я пробовал этот способ, но он не дал желаемого результата; в результате, как я и ожидал, определяется только «последняя» итерация значений.
Код: Выделить всё
for(arrIndex = 0 ; arrIndex< section_bars.length-1; arrIndex++)
{
if(section_time_cumulative[arrIndex]=time)
{
linears[arrIndex]
}
else
{
0
}
}

Подробнее здесь: https://stackoverflow.com/questions/798 ... -statement
Мобильная версия