I am running the below R code
n = 2
for(i in 1:n){
if(i+1 <= n){
for(j in i+1:n){
print(j)
}
}
}
I expect the outcome to be
[1] 2
but in fact I am getting
[1] 2
[1] 3
I am not sure where this 3 comes from. I ran the counterpart python/matlab codes, and I am getting the expected output.