if/then/else sentence


    Jan 27 2008 | 3:26 pm
    hi,
    ( first at all, my English is not good. )
    I'm trying to do the following:
    if $i1 >= 13 then out=$i1-12 else $i1
    " out=$i1-12 "
    how can I do that?
    I just want numbers over 12 to be subtracted by 12.
    is it clear?
    the solution I find is using the i$2 with one more object with the $i1-12 expr, so...
    if $i1 >= 13 then $i2 else $i1
    where $i2 is "$i1-12"
    but... i'm sure there is a way to do this with one single "if sentence", isn't it?
    thnks,
    damian.

    • Jan 27 2008 | 3:55 pm
      why not just do something like this - it seems easier to me:
      I'll have to admit that, with if statements, I probably use the
      "out2" bit more often than not.
      [ddg]
      Darwin Grosse
    • Jan 27 2008 | 4:16 pm
      Depending on what you're doing (there was no info on the context of
      what this is for) you might just be looking for %12 (modulo 12) -
      this just gives you the remainder after dividing by 12.
      ----
      Steven M. Miller
      Professor, Contemporary Music Program
      College of Santa Fe
      Home
      SFIFEM
      Atrium Sound Space
      OVOS
      CMP
    • Jan 27 2008 | 4:19 pm
      >I just want numbers over 12 to be subtracted by 12.
      I would do it like this:
      /J
      jr.abstractions for MaxMSP - new version (2008-01-15)
    • Jan 27 2008 | 4:38 pm
      thnks a lot.
      "Modulo operator" seems to be perfect.