Why does the semantics of pair differ in different usage scenarios?

20 views Asked by At

For example, for(r in 1:6){print r} returns “1, 2, 3, 4, 5“, excluding the right boundary. However, 6 between 1:6 returns true, meaning that “6“is included in the pair. Are the two contradictory?

1

There are 1 answers

0
winnie On

When used as a header specifying the iteration in loop statements, pair excludes the right boundary, which is similar to the range function in Python. However, when used in functions and SQL statements with the between operator, pair includes both boundaries.