Is possible Encapsulate a Function in Processing?

hi, can be convert a Simple Function in by a example a “Jar” that can be imported at compilation time ??

like a some found in Apache Org commons → math3, exec, io, etc.

example of function :

void adding(int x){
int y;

y=10+x;
println(y);
}

Hi @Tibiscenas,

Yes it’s possible, you need to create a Java library and package it so it can be imported in another Java project.

One possible way to do this is to use Gradle:

https://docs.gradle.org/current/samples/sample_building_java_libraries.html

Note: you can’t just package a single function. Behind the scenes the Processing IDE wraps your code inside a class that has the methods setup, draw and your custom methods. :wink: