components/blockly-src/blocks/math.js
function() {
    var PROPERTIES =
        [[Blockly.Msg.MATH_IS_EVEN, 'EVEN'],
         [Blockly.Msg.MATH_IS_ODD, 'ODD'],
         [Blockly.Msg.MATH_IS_PRIME, 'PRIME'],
         [Blockly.Msg.MATH_IS_WHOLE, 'WHOLE'],
         [Blockly.Msg.MATH_IS_POSITIVE, 'POSITIVE'],
         [Blockly.Msg.MATH_IS_NEGATIVE, 'NEGATIVE'],
         [Blockly.Msg.MATH_IS_DIVISIBLE_BY, 'DIVISIBLE_BY']];
    this.setColour(Blockly.Blocks.math.HUE);
    this.appendValueInput('NUMBER_TO_CHECK')
        .setCheck('Number');
    var dropdown = new Blockly.FieldDropdown(PROPERTIES, function(option) {
      var divisorInput = (option == 'DIVISIBLE_BY');
      this.sourceBlock_.updateShape_(divisorInput);
    });
    this.appendDummyInput()
        .appendField(dropdown, 'PROPERTY');
    this.setInputsInline(true);
    this.setOutput(true, 'Boolean');
    this.setTooltip(Blockly.Msg.MATH_IS_TOOLTIP);
  }
function() {
    var PROPERTIES =
        [[Blockly.Msg.MATH_IS_EVEN, 'EVEN'],
         [Blockly.Msg.MATH_IS_ODD, 'ODD'],
         [Blockly.Msg.MATH_IS_PRIME, 'PRIME'],
         [Blockly.Msg.MATH_IS_WHOLE, 'WHOLE'],
         [Blockly.Msg.MATH_IS_POSITIVE, 'POSITIVE'],
         [Blockly.Msg.MATH_IS_NEGATIVE, 'NEGATIVE'],
         [Blockly.Msg.MATH_IS_DIVISIBLE_BY, 'DIVISIBLE_BY']];
    this.setColour(Blockly.Blocks.math.HUE);
    this.appendValueInput('NUMBER_TO_CHECK')
        .setCheck('Number');
    var dropdown = new Blockly.FieldDropdown(PROPERTIES, function(option) {
      var divisorInput = (option == 'DIVISIBLE_BY');
      this.sourceBlock_.updateShape_(divisorInput);
    });
    this.appendDummyInput()
        .appendField(dropdown, 'PROPERTY');
    this.setInputsInline(true);
    this.setOutput(true, 'Boolean');
    this.setTooltip(Blockly.Msg.MATH_IS_TOOLTIP);
  }
function ( ) { var PROPERTIES = [ [ Blockly . Msg . MATH_IS_EVEN , 'EVEN' ] , [ Blockly . Msg . MATH_IS_ODD , 'ODD' ] , [ Blockly . Msg . MATH_IS_PRIME , 'PRIME' ] , [ Blockly . Msg . MATH_IS_WHOLE , 'WHOLE' ] , [ Blockly . Msg . MATH_IS_POSITIVE , 'POSITIVE' ] , [ Blockly . Msg . MATH_IS_NEGATIVE , 'NEGATIVE' ] , [ Blockly . Msg . MATH_IS_DIVISIBLE_BY , 'DIVISIBLE_BY' ] ] ; this . setColour ( Blockly . Blocks . math . HUE ) ; this . appendValueInput ( 'NUMBER_TO_CHECK' ) . setCheck ( 'Number' ) ; var dropdown = new Blockly . FieldDropdown ( PROPERTIES , function ( option ) { var divisorInput = ( option == 'DIVISIBLE_BY' ) ; this . sourceBlock_ . updateShape_ ( divisorInput ) ; } ) ; this . appendDummyInput ( ) . appendField ( dropdown , 'PROPERTY' ) ; this . setInputsInline ( true ) ; this . setOutput ( true , 'Boolean' ) ; this . setTooltip ( Blockly . Msg . MATH_IS_TOOLTIP ) ; }
Block for checking if a number is even, odd, prime, whole, positive,
negative or if it is divisible by certain number.
@this Blockly.Block
Block for checking if a number is even odd prime whole positive negative or if it is divisible by certain number .