Using printArray()

I'd like to print the contents of an array. I found printArray(), however, it doesn't seem to work (function does not exist)? I'm using Processing 2.0.2.

Sample Code:

float[] f = { 0.3, 0.4, 0.5 };
printArray(f);

// The above code prints:
// [0] 0.3
// [1] 0.4
// [2] 0.5

https://www.processing.org/reference/printArray_.html

Thanks very much in advance.

Tagged:

Answers

  • You can just use println(some array);. It will do the right thing...

  • I'm also @ v2.0.2! Function printArray() was made to replace the println()'s old behavior for arrays anyways! ;)

  • Ops! Sorry. I missed the version. I'm using 2.0.1....

  • edited July 2014

    _vk, you're not wrong ;) Thanks guys!

    GoToLoop - Understood. I'm curious, though, does printArray() work for you or no?

  • edited July 2014 Answer ✓

    Newest function printArray() was introduced @ v. 2.2 or so I believe.
    Since I'm @ v. 2.0.2, it doesn't even exist! Function println() has the printArray()'s behavior when it comes to printing arrays out! ~:>
    Same is true for "JS Mode"! it doesn't exist there either!!! [..]

Sign In or Register to comment.