Hello There, Guest!
View New Posts  |  View Today's Posts
Go programming language

  • 0 Vote(s) - 0 Average


06-25-2015, 09:13 AM #1
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

Go programming language
I've heard a lot of buzz about go but I'm just now getting a chance to look at it, and so far... I LOVE IT! I don't think I'd ever be able to give up my baby (C#), but I'm really liking some of the things that Go does differently. 
Check out this for example:
Code:
package main

import (
    "fmt"
    "strconv"
    )

func main() {
    demoList := []string{"test1","test2","test3"}
    
    for i,data := range demoList{
        fmt.Println(strconv.Itoa(i) + ":" + data)
    }
}

This outputs:
Code:
0:test1
1:test2
2:test3

When using range to loop over lists (arrays,slices,etc), it returns multiple variables at the same time. In the case of range, it returns the index, and the data element. When writing functions you can have them return multiple elements as well, instead of having to encapsulate them in classes, like you would in languages like C#.
This post was last modified: 06-25-2015, 09:27 AM by KoBE.




Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
  Programming Music AceInfinity 5 1,930 10-27-2015, 05:28 PM
Last Post: Sam Baker
  SQL Programming? william7 7 4,074 02-25-2015, 08:39 PM
Last Post: william7
   Quick Programming Challenge! AceInfinity 16 8,061 08-04-2014, 10:57 PM
Last Post: AceInfinity
  Free (legal) Windows phone programming ebooks Shintaro 2 1,754 06-06-2014, 04:50 PM
Last Post: Shintaro
  Factor Programming AceInfinity 0 1,485 04-06-2014, 12:54 AM
Last Post: AceInfinity


Users browsing this thread: 1 Guest(s)