We are about to switch to a new forum software. Until then we have removed the registration on this forum.
For me int() doesn't work. I get an error saying that int is not defined. I am using the p5 editor. Is this an editor issue?
Create a very simple example that demonstrates this error and post it here.
When I create a sketch with nothing more than this:
I get: Uncaught ReferenceError: int is not defined
Just deleted my last answer because I tested in Java mode.
But I have taken the int() command from the reference docs.
parseInt() seems to work though.
If you just wanna truncate an operation, simply adding up | 0 to it can be faster than parseInt(): :-B
11*1.5 | 0
11/2 | 0
Nevertheless, parseInt() is still useful to safely convert other types like String to int! (*)
Including those w/ different radices like hexadecimal, octal, etc.! :P
Just to clarify. This is a link to the reference docs:
But when I try it, I get an error saying: Uncaught ReferenceError: int is not defined
Guess you're gonna need to open an issue there: https://github.com/lmccart/p5.js/issues 8-|
I just did ;)