RCPTT - Can't accept return from procedure as if condition

327 Views Asked by At

When I try to use the procedure in the if-condition below, it doesn't work.

proc "isAvailable"{
  bool false
}

loop[val index [int 0]]{

    if[isAvailable]{
          show-alert "Test"
    } else {
          show-alert[ $index |str]
    }
    if [$index | lt 200 ]{
          recur [$index | plus 50]
    }
}

The error message is Cannot match given parameters to declared parameters at if but I don't understand this message. Is a paramter needed as input to a procedure?

1

There are 1 best solutions below

0
On

Procedures can be declared without any parameters.

However, as the name "proc" suggests, they are only procedures: a set of commands without a returned value.