Hello all -
I'm new to processing, and I'm looking for a good beginner's guide. Specifically, the issues I'm having trouble with are when to call the setup() and draw() functions, and how to return a value from the function.
I've looked through the references, and they're great for a reference, but they don't explain how and when to use something. The examples are great examples, but they don't help me understand how to properly constuct or troubleshoot my own code. I guess what I'm saying is that I'm looking for a significant amount of hand-holding at this point
Here's a specific example of something I'm having problems with: I want to make a function that calculates the length of a line. The example for functions doesn't give an example function that returns a value. I couldn't find 'functions' in the reference. I only happened upon a reference by running into the keyword 'return'. So, I write this:
float lineLength( float x1, float y1, float x2, float y2 ){
return sqrt( abs(x1-x2)^2 + abs(y1-y2)^2 ) );
}
When I run this in some code, I get 'unexpected token: float'. The project where I'm trying to add this runs otherwise, without my function, so I don't think it's a syntax error elsewhere in the code. I don't really have any idea why I'm getting this error.