added functions in SGNDArray

@iglesias @hushell
Could you help me to check this patch? Thanks!
 if/for with only 1 line in the main body, remove {}, and new line after if/for