say_my_name <- function(name_in) {
  # Print a single name in the prompt
  #
  # ARGS: name_in - Name to be printed
  #
  # RETURNS: TRUE, if sucessfull

  my_msg <- paste0('Your name is ', name_in)

  message(my_msg)

  # invisible will omit output if function is called without definition of output
  return(invisible(TRUE))
}

# testing
say_my_name('Marcelo')
# none
my_answers <- rep(0, 5)

Question

Crie uma função chamada say_my_name que tome como entrada um nome de pessoa e mostre na tela o texto Your name is .... Dentro do escopo da função, utilize comentários para descrever o propósito da função, suas entradas e saídas.

Solution


Meta-information

extype: string exsolution: r mchoice2string(c(TRUE, FALSE, FALSE, FALSE, FALSE), single = TRUE) exname: "function 01" exshuffle: TRUE



msperlin/adfeR documentation built on March 26, 2021, 3:05 a.m.