David - My question to you may sound (actually, it really is) silly, but please do take your time to answer it.
What is the difference between: fac<-function(x){a<-1 for (i in 1:x){ a<-a*i }a} and: fac<-function(x){a<-1 for (i in 1:x){ a<-a*i } a} I did try the first one, but I got an error message, so I thought I was doing something wrong. However, once it finishes the loop, why the difference between the last lines? Best wishes! Mike -- View this message in context: http://r.789695.n4.nabble.com/Using-FUNCTION-to-create-usable-objects-tp4588681p4590774.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.