R_Code-9.r (285B)
1 # Define a function called power that takes two parameters, 2 # a and b. Give a a default value of 2. The function should print the result 3 # of a raised to the power of b (a^b). 4 5 power <- function (a = 2, b) { 6 return (a^b) 7 } 8 a <- 2 9 b <- 3 10 print(power(a, b)) 11 print(power("b" = b))