kind-rain-45283
06/26/2024, 4:12 AMjs
function sumRange(a, b) {
// Ensure a is less than or equal to b
if (a > b) {
return 0;
}
let sum = 0;
for (let i = a; i <= b; i++) {
sum += i;
}
return sum;
}
Would I be able to define this function somehow so that I can use it later? I tried simply entering this code into an Execute Code card in the beginning of my workflow, but when calling this function later, it gives me an error saying sumRange is not definedfresh-fireman-491
06/26/2024, 8:24 AMnumerous-secretary-37683
06/26/2024, 2:00 PMnumerous-secretary-37683
06/26/2024, 2:01 PMfresh-fireman-491
06/26/2024, 2:10 PMnumerous-secretary-37683
06/26/2024, 5:03 PMfresh-fireman-491
06/26/2024, 5:23 PMnumerous-secretary-37683
06/26/2024, 5:25 PMfresh-fireman-491
06/26/2024, 5:35 PMnumerous-secretary-37683
06/26/2024, 5:36 PMfresh-fireman-491
06/26/2024, 5:36 PM