Arithmetic operation inside custom gradle task

I am new to gradle. I have 2 variables whose values I want to add and use it inside a custom rask.
How can I do this?


Given the following variables in your build script you can add both variables and assign them to a new variable.

Integer var1 = 1
Integer var2 = 2
Integer var3 = var1 + var2

Then simply expose a property in the custom task and assign the relevant value when creating an enhanced task.

task myTask(type: MyCustomTask) {
    myProp = var3

class MyCustomTask extends DefaultTask {
     Integer myProp


can someone help me on this task,

create a custom class mathtask that takes the first 10 numbers appearing in the fibonacci sequence as well as the lucas sequence and prints the sum of numbers appearing in the respective positions(i.e takes the first number from both the series and calculate the sum and prints it, then takes the second and do the same until tenth numbers)