Arrays

GetGoing: Introduction to Golang Data types and control structure
3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
This is a free item
$0.00
د.إ0.00
Kz0.00
ARS$0.00
A$0.00
৳0.00
Лв0.00
Bs0.00
B$0.00
P0.00
CA$0.00
CHF 0.00
CLP$0.00
CN¥0.00
COP$0.00
₡0.00
Kč0.00
DKK kr0.00
RD$0.00
DA0.00
E£0.00
ብር0.00
€0.00
FJ$0.00
£0.00
Q0.00
GY$0.00
HK$0.00
L0.00
Ft0.00
₪0.00
₹0.00
ISK kr0.00
¥0.00
KSh0.00
₩0.00
DH0.00
L0.00
ден0.00
MOP$0.00
MX$0.00
RM0.00
N$0.00
₦0.00
C$0.00
NOK kr0.00
रु0.00
NZ$0.00
S/0.00
K0.00
₱0.00
₨0.00
zł0.00
₲0.00
L0.00
QR0.00
SAR0.00
SEK kr0.00
S$0.00
฿0.00
₺0.00
$U0.00
R0.00
ZK0.00
Already have an account? Log In

Transcript

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

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.