Skip to content

Instantly share code, notes, and snippets.

@lcolladotor
Last active January 1, 2016 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcolladotor/8203492 to your computer and use it in GitHub Desktop.
Save lcolladotor/8203492 to your computer and use it in GitHub Desktop.
pablo's 2013 gift code
## Initialization of j
j <- 0
for(i in seq(from=1, to=10, by=1)) {
## Note that x %% y is
## x mod y
## Pre-evaluation of j
j <- j + i %% 2
## Post-evaluation of j
## Code question 1
if(i == 5) {
print(paste("When i = 5,
the value of j (post evaluation of j) is", j))
}
}
## Code question 2? Final value of j
print(paste("The final value of j is", j))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment