R: Backwards for loop

1
2
3
for (i in 10:1) {
	print(i)
}

As easy as that.

Tags:

2 comments

  1. Input
    T<-10
    for (t in (T-1:1)){
    print("yes")
    for (s in (1:10)){
    print(s)
    }
    }

    Output:
    yes
    1 to 10 printed…
    Thus, outer loop is executed only once. I don't know what Im missing.

Leave a comment