סקר מחקר: נשמח לשמוע על החוויה שלך עם Blockly
לפתיחת הסקר
blockly > CodeGenerator > blockToCode
שיטת CodeGenerator.blockToCode()
יצירת קוד לבלוק שצוין (ולבלוקים המצורפים). צריך לאתחל את המחולל לפני קריאת הפונקציה הזו.
Signature:
blockToCode(block: Block | null, opt_thisOnly?: boolean): string | [string, number];
פרמטרים
פרמטר |
סוג |
תיאור |
חסימה |
חסימה | null |
הבלוק שעבורו יש ליצור קוד. |
opt_thisOnly |
בוליאני |
(אופציונלי) הערך הוא True כדי ליצור קוד רק עבור ההצהרה הזו. |
החזרות:
מחרוזת | [מחרוזת, מספר]
לבלוקים של הצהרות, הקוד שנוצר. לבלוקים של ערכים, מערך שמכיל את הקוד שנוצר וערך הזמנה של אופרטור. מחזירה '' אם החסימה היא null.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-08-21 (שעון UTC).
[null,null,["עדכון אחרון: 2024-08-21 (שעון UTC)."],[[["The `blockToCode` method generates code for a specified Blockly block and any attached blocks."],["It requires the code generator to be initialized before use and accepts the block and an optional flag to generate code for only the given block."],["The method returns the generated code as a string for statement blocks or an array containing the code and an operator precedence for value blocks, returning an empty string if the input block is null."]]],["The `blockToCode` method generates code for a specified block and its attachments. It requires prior initialization of the code generator. It accepts a block and an optional boolean `opt_thisOnly` to limit code generation to only the provided block. The method returns either a string representing the generated code for statement blocks or an array containing code and operator order for value blocks. If the provided block is null it will return an empty string.\n"]]