ব্লক

ব্লক আপনি প্রোগ্রাম ব্যবহার কি. তারা পাঠ্য-ভিত্তিক প্রোগ্রামিং ভাষায় অভিব্যক্তি এবং বিবৃতি উপস্থাপন করে।

ব্লক সম্পর্কে আরও তথ্যের জন্য এবং তাদের অংশগুলি কেমন দেখতে, ভিজ্যুয়াল শব্দকোষটি দেখুন।

ব্লক সংজ্ঞা

একটি ব্লক সংজ্ঞা আপনার ব্লকে ধাঁধা অংশ সংযোগ এবং ক্ষেত্র নির্দিষ্ট করে। আপনার ব্লকের বেশিরভাগ চেহারা এবং শৈলী অন্য উপায়ে নির্দিষ্ট করা হয়েছে। আপনার ব্লক যে স্ট্রিং (সাধারণত কোড) রূপান্তরিত হয় সেটিকে ব্লক-কোড জেনারেটর হিসাবে সংজ্ঞায়িত করা হয়।

সাধারণ ব্লক সংজ্ঞায়িত করার সবচেয়ে সহজ উপায় হল JSON ব্যবহার করা।

এই কোড স্নিপেট পরবর্তী এবং পূর্ববর্তী সংযোগগুলির সাথে একটি "মুভ ফরওয়ার্ড" ব্লক এবং দূরত্বের জন্য একটি ক্ষেত্র সংজ্ঞায়িত করে।

// Create the definition.
const definitions = Blockly.createBlockDefinitionsFromJsonArray([
  {
    // The type is like the "class name" for your block. It is used to construct
    // new instances. E.g. in the toolbox.
    type: 'my_custom_block',
    // The message defines the basic text of your block, and where inputs or
    // fields will be inserted.
    message0: 'move forward %1',
    args0: [
      // Each arg is associated with a %# in the message.
      // This one gets substituted for %1.
      {
        // The type specifies the kind of input or field to be inserted.
        type: 'field_number',
        // The name allows you to reference the field and get its value.
        name: 'FIELD_NAME',
      }
    ],
    // Adds an untyped previous connection to the top of the block.
    previousStatement: null,
    // Adds an untyped next connection to the bottom of the block.
    nextStatement: null,
  }
]);

// Register the definition.
Blockly.defineBlocks(definitions);

এগিয়ে যাওয়ার জন্য একটি ব্লক

আপনার ব্লক কিভাবে সংজ্ঞায়িত করবেন সে সম্পর্কে আরও তথ্যের জন্য, ব্লক সংজ্ঞায়িত করুন দেখুন।

আপনার টুলবক্সে আপনার ব্লক কিভাবে অন্তর্ভুক্ত করবেন সে সম্পর্কে তথ্যের জন্য, টুলবক্স ওভারভিউ দেখুন।