mardi 1 juillet 2014

a if statement with a true logic value then followed by a false value


Vote count:

0




Can anybody help me understand the following function?


looks the firstRun was assigned a logical TRUE value to it at the beginning of function. then why in the if(firstRun) function, a FALSE was assigned to firstRun again? what does that FALSE do?





RunIterativeStrategy <- function(mktdata){
firstRun <- TRUE
for(a in 1:3) {
for(b in 1:3) {
runResult <- TradingStrategy(mktdata,a,b)
if(firstRun){
firstRun <- FALSE
results <- runResult
} else {
results <- cbind(results,runResult)
}
}
}
return(results)
}


many thanks



asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire