Hacker News new | past | comments | ask | show | jobs | submit login

It's range that gets me all the time, some make the end inclusive, some exclusive.

    Clojure
    (range 1 10)
     ;=> (1 2 3 4 5 6 7 8 9)

    C#
    Enumerable.Range(1, 10).PrintAll();
    1 2 3 4 5 6 7 8 9 10
    
    Ruby
    (1..10).each { |n| puts n }
    #=> 1 2 3 4 5 6 7 8 9 10

    Python
    for i in range(1, 10):
    print(i, end=', ')
    => 1 2 3 4 5 6 7 8 9



well Ruby is a weird example since it has both using either '..' or '...'


Oh, I didn't know about '...'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: