Loop over a vector

Write a for loop that iterates over all the elements of linkedin and prints out every element separately. Do this in two ways: using the loop version 1 and the loop version 2 in the example code above

Loop version 1

linkedin <- c(16, 9, 13, 5, 2, 17, 14)

for (i in linkedin){
  print(i)
}
## [1] 16
## [1] 9
## [1] 13
## [1] 5
## [1] 2
## [1] 17
## [1] 14

Loop version 2:

for (i in 1:length(linkedin)){
 print(linkedin[i]) 
  }
## [1] 16
## [1] 9
## [1] 13
## [1] 5
## [1] 2
## [1] 17
## [1] 14