Bug in C.O.F.F.E.E. node [SOLVED]

On 04/01/2015 at 09:10, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:      Mac OSX  ; 
Language(s) :   C.O.F.F.E.E  ;

---------
Hi,

I have an xpresso file with a C.O.F.F.E.E. node.
This is the code:

main()
{
  if (body == 0)
      {
          arms = 0;
      } elif (body == 1) {
          arms = 1;
      } elif (body == 2) {
          arms = 1;
      } elif (body == 3) {
          arms = 1;
      } elif (body == 4) {
          arms = 2;
      }
}

Where body and arms are two variables of the type integer.
But I get a COFFE ERROR! Variable or function expected
Line: 6
Row: 13
which is, after the first elif, and after the open parenthesis: body, which is a variable.

Does somebody see the problem here?
Thanks in advance for your help! 🙂

On 04/01/2015 at 23:53, xxxxxxxx wrote:

Hi,

"elif" keyword doesn't exist in C.O.F.F.E.E.
Use "else if" instead.

On 05/01/2015 at 02:15, xxxxxxxx wrote:

Hi,

Thanks for your answer!
I should clearly pay more attention to which language I'm using.
Guess I'm too much used to Python 😛

On 05/01/2015 at 05:52, xxxxxxxx wrote:

Howdy,

You could also simplify your code like this:

main()
{
	arms = body;
	if(body > 1 && body < 4) arms = 1;
	else if(body > 3) arms = 2;
}

Adios,
Cactus Dan

On 05/01/2015 at 06:08, xxxxxxxx wrote:

That's right!

Thanks for your help!!

Greetings,
Casimir Smets