Is there a way to check if the previous value in the template range is 
different from the current one?

type Data struct {
Value int32
}

var htmlTemplate = `{{range $i, $el := .}}
{{$i}}:{{.Value}}: (is it diff from previous value, i.e. data[i-1])
{{end}}`

Intended use: to change the color of certain cells in a table if it is 
different from that in previous row.

code: https://play.golang.org/p/v-O_M4Rq4N

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to