2 categories::Core, Common methods
3 related:: Reference/Control-Structures
4 summary:: conditional execution
10 if ( [false, true].choose, // Boolean expression (chooses one at random)
11 { "expression was true".postln }, // true function
12 { "expression was false".postln } // false function
17 z = if (a < 5, { 100 },{ 200 });
24 the condition ugen is 0 / 1
29 if( LFNoise1.kr(1.0,0.5,0.5) , SinOsc.ar, Saw.ar )
34 section:: optimization
36 the functions will be inlined, which plucks the code from the functions and uses a more efficient jump statement.
50 4 E6 SendSpecialBinaryArithMsg '=='
51 5 F8 00 06 JumpIfFalse 6 (14)
52 8 42 PushLiteral "hello"
53 9 A1 00 SendMsg 'postln'
54 11 FC 00 03 JumpFwd 3 (17)
55 14 41 PushLiteral "hello"
56 15 A1 00 SendMsg 'postln'
58 a FunctionDef in closed FunctionDef
64 failure to inline due to variable declarations
77 WARNING: FunctionDef contains variable declarations and so will not be inlined.
78 in file 'selected text'
82 -----------------------------------
86 4 E6 SendSpecialBinaryArithMsg '=='
87 5 04 00 PushLiteralX instance of FunctionDef in closed FunctionDef
88 7 04 01 PushLiteralX instance of FunctionDef in closed FunctionDef
89 9 C3 0B SendSpecialMsg 'if'
91 a FunctionDef in closed FunctionDef
106 4 E6 SendSpecialBinaryArithMsg '=='
107 5 F8 00 06 JumpIfFalse 6 (14)
108 8 42 PushLiteral "hello"
109 9 A1 00 SendMsg 'postln'
110 11 FC 00 03 JumpFwd 3 (17)
111 14 41 PushLiteral "hello"
112 15 A1 00 SendMsg 'postln'
114 a FunctionDef in closed FunctionDef