x = runif(10)

#1
if(sum(x)>5) {
  cat('sum(x) is greater than 5.\n')
} else if(sum(x)<5) {
  cat('sum(x) is less than 5.\n')
} else
  cat('sum(x) is equal to 5.\n')

#2
y = ifelse(x<0.5,x,x-0.5)

#3
i=3
switch(i,x+y,x-y,x*y)