{ "blocks": { "languageVersion": 0, "blocks": [ { "type": "variables_set", "id": "set_numero", "x": 50, "y": 50, "fields": { "VAR": { "id": "numero" } }, "inputs": { "VALUE": { "block": { "type": "math_number", "id": "input_num", "fields": { "NUM": 5 } } } }, "next": { "block": { "type": "variables_set", "id": "set_fatorial", "fields": { "VAR": { "id": "fatorial" } }, "inputs": { "VALUE": { "block": { "type": "math_number", "id": "one", "fields": { "NUM": 1 } } } }, "next": { "block": { "type": "variables_set", "id": "set_i", "fields": { "VAR": { "id": "i" } }, "inputs": { "VALUE": { "block": { "type": "math_number", "id": "start_one", "fields": { "NUM": 1 } } } }, "next": { "block": { "type": "controls_repeat_ext", "id": "loop_fatorial", "inputs": { "TIMES": { "block": { "type": "variables_get", "id": "get_numero_times", "fields": { "VAR": { "id": "numero" } } } }, "DO": { "block": { "type": "variables_set", "id": "update_fatorial", "fields": { "VAR": { "id": "fatorial" } }, "inputs": { "VALUE": { "block": { "type": "math_arithmetic", "id": "multiply", "fields": { "OP": "MULTIPLY" }, "inputs": { "A": { "block": { "type": "variables_get", "id": "get_fatorial", "fields": { "VAR": { "id": "fatorial" } } } }, "B": { "block": { "type": "variables_get", "id": "get_i", "fields": { "VAR": { "id": "i" } } } } } } } }, "next": { "block": { "type": "math_change", "id": "increment_i", "fields": { "VAR": { "id": "i" } }, "inputs": { "DELTA": { "shadow": { "type": "math_number", "id": "delta_one", "fields": { "NUM": 1 } } } } } } } } }, "next": { "block": { "type": "text_print", "id": "print_result", "inputs": { "TEXT": { "block": { "type": "text_join", "id": "join_text", "extraState": { "itemCount": 3 }, "inputs": { "ADD0": { "block": { "type": "variables_get", "id": "get_numero_print", "fields": { "VAR": { "id": "numero" } } } }, "ADD1": { "block": { "type": "text", "id": "text_label", "fields": { "TEXT": "! = " } } }, "ADD2": { "block": { "type": "variables_get", "id": "get_fatorial_print", "fields": { "VAR": { "id": "fatorial" } } } } } } } } } } } } } } } } } ] }, "variables": [ { "name": "numero", "id": "numero" }, { "name": "fatorial", "id": "fatorial" }, { "name": "i", "id": "i" } ] }