Conditional Statements

matthewg's icon

I've been having some problems with conditional statements. From a single number input, i need to trigger a bang in a specific range (eg 40-50). All attempts with varying uses of && and || have been spitting out errors.

I've tried searching around here and elsewhere on the 'net but can't actually find anything relating to two conditions on a single number.

Any help would really be appreciated.

yacine's icon

here is a simple way with a split object

//yac
______________________________________

Max Patch
Copy patch and select New From Clipboard in Max.

matthewg's icon

Thank you very much. That worked like a charm.

Peter McCulloch's icon

Here's an abstraction called PM.Zones that will classify an input
stream into various zones. Different way of solving the problem. This
might be handy, because it's open-ended. (whereas split is binary in
its decision) Input a list with the boundaries in the right. (e.g.
10 20 80 90 107) It'll output which the zone that the input is in out
the left.

Peter McCulloch

Max Patch
Copy patch and select New From Clipboard in Max.


Falk's icon
Peter Castine's icon

On around Feb 25, 2006, at 14:32, Falk Grieffenhagen said something
like:
> #P newex 60 85 161 196617 if $i1>= 40 & $i1

You want && (double ampersand).

Single ampersand is doing something different. It will work in this
case but it is not doing what you think it is doing (unless you're
being more clever than is appropriate for a read-the-friendly-tutorials
question).

-- Peter

-------------- http://www.bek.no/~pcastine/Litter/ --------------
Peter Castine | ^
| Litter Power & Litter Bundle for Jitter
pcastine@gmx.net |
pcastine@bek.no | iCE: Sequencing, Recording, and Interface Building
4-15@kagi.com | for Max/MSP
| Extremely cool
| http://www.dspaudio.com
| http://www.dspaudio.com/software/software.html