I'm new in Go and I have 2 questions:
1 Let's say we have simple for loop written in C#:
static void Main(string[] args)
{
List<int> list = new List<int>();
for (int i = 1; i < 10000; i++)
{
if (i % 5 == 0 && i % 3 == 0)
{
list.Add(i);
}
}
foreach (int prime in list)
{
System.Console.WriteLine(prime);
}
Console.ReadKey();
}
If I wanted to do the same in Go I'll have to use slices. But how to do that?
- Which of variable declaration form is more often used: short form (s:= 3) or long (var s int = 3)?
var). - Andy Schweig