A number literal with begins with 0 differs between programming languages. For example, a programming language considers 015 as 13, or as 15 just by ignoring the first 0, or even throws an error.
I categorized some programming languages by the view.
- 015 == 13
- Clojure
- Scala
- Java
- Ruby
- C
- Vim script
- JavaScript
- 015 == 15
- Haskell
- Scheme
- Emacs Lisp
- Lua
- Common Lisp
- Exception
- Python
- CoffeeScript
python 2.7.1 considers 015 as 13:
ReplyDelete>>> 015 == 13
True
oh I didn't check in 2.7 family. thanks!
ReplyDelete