Welcome to the new and improved Native Instruments online community. Join our active forum of 40,000+ members for discussions and much more.
Ho do I make a function with if?

mr_blond97
Member Posts: 2 Newcomer
I make a function that contains if:
on init message(Add(1,2)) end on function Add(x,y) -> output if x > 0 output := x + y else output := 0 end if end function
And I get the error message:
The definition of function Add needs to consist of a single line (eg. "result := <expr>") in order to be used in this context
Ho do I make a function with if?
Tagged:
0
Best Answer
-
You cannot call a function within another command like that, you need to store the output of it to a variable. So:
var = Add(x, y) message(var)
0
Answers
-
You cannot call a function within another command like that, you need to store the output of it to a variable. So:
var = Add(x, y) message(var)
0 -
Thank you!
on init declare $var $var := Add(1, 2) message(var) end on function Add(x,y) -> output if x > 0 output := x + y else output := 0 end if end function
0
Back To Top
Categories
- 10.8K All Categories
- 22 Welcome
- 450 Hangout
- 59 NI News
- 209 Tech Talks
- 1.1K Native Access
- 4.9K Komplete
- 623 Komplete General
- 1.1K Komplete Kontrol
- 1.9K Kontakt
- 491 Reaktor
- 157 Battery 4
- 271 Guitar Rig & FX
- 203 Massive X & Synths
- 213 Other Software & Hardware
- 2.3K Maschine
- 14 Sampling Room
- 2.6K Traktor
- 2.4K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators