Re: [go-nuts] Testing on Go templates Range's index

2017-09-09 Thread Jan Mercl
On Sat, Sep 9, 2017 at 6:01 PM Tong Sun  wrote:

As documented , ne is
a function, not an infix operator: https://play.golang.org/p/sJSzoNyrJz


-- 

-j

-- 
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.


[go-nuts] Testing on Go templates Range's index

2017-09-09 Thread Tong Sun
Hi, 

If I have Go templates Range declared like this,

{{range $i, $x := $.People}}

How can I test its index value? 

I thought it should be `{{if $i ne 0}}` but it is not working for 
me: https://play.golang.org/p/NB10G1CjBr
I've also tried `{{if $i ne "0"}}`, but that failed on me as well. 

FTA, without the testing, it works 
fine: https://play.golang.org/p/OgvVAdt24X

Thanks for helping


-- 
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.