Is it good practice to name variables differently when defining more than one function?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-03-25T22:22:06Z Indexed on 2010/03/25 22:33 UTC
Read the original article Hit count: 245

For example, in this simple function where fun1 takes as input two numbers, adds them together and passes them to function 2 for printing the output. var1_in is local to each function, so is it OK to use the name var1_in in both functions, or is it better practice to call them different things?

fun1 <- function (var1_in, var2_in) {
    var3 = var1_in + var2_in
    fun2(var3)
    }

fun2 <- function (var1_in) {
    var4 = var1_in
    print(var4)
    }

© Stack Overflow or respective owner

Related posts about good-practice

Related posts about functions