Hi guys, in this video we're going to be talking about some of the more abstract data types in go. So, one data type which is in almost every language is arrays. So, an array or an array, as some people like to call it is just a list of ordered items. So in got the all of the areas they need to be symbolic of a particular data structure of a particular data type. So, let's say we create a function to do. So how you define an array is the same way you define a video with Bert that it does some changes take you to square bracket and so this is the way that you define an array.
To initialize an array you have to do an array is equal to this is the way that you initialize an array. So like in this array 123 Let's see what happens if empty dot print line and then we simply call this function in the main function. To do. So you might have noticed that I've created a new file in last lectures, we were using the main file in this. In this video we're using the main two.go file. So you can notice that the package is still made.
So we can call the swap function in main two codes. So you can also do a swap over here see the swap function is defined. On running main.go lecture to run main Do we have an ID 123 and four. So you can also create a string or you can do two is equal to string Hi, my name decided to go. So to append things to an array, what you can do is you can use the inbuilt append function. So added to is equal to append to and just enter whatever item that you want to pay.
So if we append this in attitude we have added the append function just returns a new array with the added item of whatever you wanted to append in that. So we appended only one item here. So let's say we want to append two items or three items over here. So let's see what happens in this case. It runs, so you're gonna bend how many ever items you want. In this i.
So this was about appending to an array and declaring an array. Now we're going to be talking a bit more about what are structures