Parameter sets - Value Repetitions

Prev Next

Parameter Sets - Value Repetitions

Large parameter sets with same values repeating can be built up with value repetitions. Repetitions are specified by numeric values following a colon symbol and following the paramter set element to repeat. Multiple repetitions may be specified inside a parameter set value.


  echo({ 5:0 } );              // Generates { 0,0,0,0,0 }
  echo({ 2:3,3:2 } );          // Generates { 3,3,2,2,2 }
  echo({ 0.9:A } );            // Generates { A }  Rounded up
  echo({ 0.1:A } );            // Generates { }  Rounded down
  echo({ 2:Hello } );          // Generates { Hello,Hello}
  echo({ 0:Hello } );          // Generates { }
  echo({ -2:Hello } );         // Generates { }
  echo({ 3:{a,b} } );          // Generates { {a,b},{a,b},{a,b} }
  echo({ 2:{3:1} } );          // Generates { {1,1,1},{1,1,1} }
  echo({ 2:{1..4} } );          // Generates { {1,2,3,4},{1,2,3,4} }
{0,0,0,0,0}
{3,3,2,2,2}
{'A'}
{}
{'Hello','Hello'}
{}
{}
{{'a','b'},{'a','b'},{'a','b'}}
{{1,1,1},{1,1,1}}
{{1,2,3,4},{1,2,3,4}}
Try it yourself: Open LAN_Features_data_types_parameter_sets_value_repetitions.b4p in B4P_Examples.zip. Decompress before use.