FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   array literal syntax
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: array literal syntax  (Read 258 times)
kevinP

Email
array literal syntax
« on: Jun 6th, 2004, 11:12pm »

With a method signature such as this:
PolarPolygon(int[] vertices, int[] sides, float _xPos, float _yPos)
 
...am I not allowed to call it like this:
 polyA = new PolarPolygon({ 0, 120, 240 }, { unit, unit, unit }, width/2, height/2);
 
?
 
Error message is "Unexpected token: {"  
 
-K
 

Kevin Pfeiffer
TomC

WWW
Re: array literal syntax
« Reply #1 on: Jun 7th, 2004, 12:18am »

You can do:
 
Code:

 
 polyA = new PolarPolygon( new int[] { 0, 120, 240 }, new int[] { unit, unit, unit }, width/2, height/2);  
 
 
 
kevinP

Email
Re: array literal syntax
« Reply #2 on: Jun 7th, 2004, 11:45am »

Yes! And I even remember now seeing that in the Nutshell book. I was trying to do an anonymous array, but the wrong way.
 
Thanks,
 
-K
 

Kevin Pfeiffer
Pages: 1 

« Previous topic | Next topic »