Below code increments only ith element of that slice. Is there something inbuild that i can increment all elements with 1. Please suggest.

for i:= 0; i< k ;i++{
    if(slice[i] < K){
        slice[i] = slice[i] + 1
    }
}