Learning Target
1. 如何宣告方法 function
Note
請參考以下我的 R Script
#利用function這個方法來宣告方法
test <- function(a, b){
  if(b==0) return("b can't be zero")
  else return(a %% b)}
#將 test 這個 function 回傳值放到 result 這個變數
result <- test(5, 0)
print(result)
#利用function這個方法來宣告方法
test <- function(a, b){
  if(b==0) return("b can't be zero")
  else return(a %% b)}
#將 test 這個 function 回傳值放到 result 這個變數
result <- test(5, 0)
print(result)
0 comments:
Post a Comment