Write function wt

Hey guys, i need write wt function with using this code, help me please

Pas_arrival=runif(1, min = 0, max=100)
Bus_arrival=seq(10, 100, by = 10)
t <- Bus_arrival-Pas_arrival
t=min(t[t>=0])

Highlight the code in an RStudio source pane. From the top menu bar, choose Code | Extract Function, provide a name when prompted and you will get

wt <- function() {
  Pas_arrival=runif(1, min = 0, max=100)
  Bus_arrival=seq(10, 100, by = 10)
  t <- Bus_arrival-Pas_arrival
  t=min(t[t>=0])
}

However, `wt()` will appear to do nothing because no value was returned. Either add `return(t) after the last line or just remove `t=`

This might not give you what you want if you have `Pas_arrival` and `Bus_arrival` vectors that are not random. How would you modify the function to take arguments representing those values?