exercises/02-11.R

# To run this file on R, do:
# source("./exercises/02-11.R")

# The linkedin vector has already been defined for you
linkedin <- c(16, 9, 13, 5, 2, 17, 14)

# Adapt/extend the for loop
for (li in linkedin) {
  if (li > 10) {
    print("You're popular!")
  } else {
    print("Be more visible!")
  }
  # Add if statement with break
  if (li > 16) {
    print("This is ridiculous, I'm outta here!")
    break
  }
  # Add if statement with next
  if (li < 5) {
    print("This is too embarrassing!")
    next
  }
  print(li)
}
anapaolapp18/R-Exercises documentation built on Dec. 8, 2019, 10:27 a.m.