Misty Lessons
  • Misty Lessons
    • 📖Welcome to Misty Lessons
    • 📚Get to know your Misty
    • 📲Connect to Misty
    • 👩‍💻Misty Studio
    • 🖥️Desktop Environment
    • ⬆️Update your Misty
    • 👥Projects
  • Blockly
    • 🧩Blockly Lessons
      • 🤸Lesson 1: Movement
      • 🎶Lesson 2: Voice and Sound
      • 🎭Lesson 3: Expressions
      • 🎥Lesson 4: Robot Cinema
      • 🛠️Lesson 5: Events
      • ☺️Lesson 6: Face recognition
      • 🔢Lesson 7: Variables and Functions
      • 💬Lesson 8: NLP
    • 🏫Blockly projects
  • Blockly Elements
    • ⚛️Misty Blocks
      • Movement
      • Speech
      • Audio
      • Vision
      • Events
      • Miscellaneous
      • NLP
      • System
    • 🔁Basic Blocks
      • Logic
      • Loops
      • Math
      • Text
      • Lists
    • 🅰️Advanced Blocks
      • Variables
      • Functions
  • Python
    • 🐍Python Lessons
      • 🦿Lesson 1: Loco-motion
      • 🤖Lesson 2 : Build a character
      • 🧠Lesson 3: Create memories
      • ⚒️Lesson 4: Event skills
      • 👀Lesson 5: Expand awareness
      • 🔗Lesson 6: Compact code
      • 🗣️Lesson 7: Start a conversation
  • Python Elements
    • 🐸Misty Python API
      • Motion and Mobility
      • Display and LED
      • Record Assets
      • Change/Remove Assets
      • Stream Assets
      • Get Assets
      • Events
      • Sensor Events
      • Speech and NLP
      • Arduino Backpack
      • System
      • Slam
    • 📗Python Definitions
  • Python Projects
    • 🔮MistyGPT
    • 🚨Misty Intruder Alert
    • 📺Conference Assistant
    • 🏷️QR code detector
    • 🕵️‍♂️Misty follow human
    • 👋Misty wave back
    • 🖲️Misty OA
    • 🌐Get weather
    • 🚚Misty Delivery
    • 🫂Motivational Misty
    • 🖼️Misty Museum Guide
    • 🎃Who for Halloween
  • ARDUINO
    • ♾️Arduino Backpack
    • 🦎Arduino
    • 🔧Arduino Lessons
      • 🔌Arduino to Misty
      • ➕Misty to Arduino
  • ARDUINO PROJECTS
    • 🛠️Misty Tracker
    • 🦾Misty Arm
  • Community Projects
    • 🌤️Misty weather forecaster
  • HARDWARE EXTENSION
    • ⚙️Arduino breadboard support
    • 🦾Misty arm
    • 🥤Tin holder
  • Resource Database
    • 📁Image files
    • 📁Audio files
    • 📁Languages
    • 📁Known objects
    • 📁NLP Actions
    • 📁Action Commands
    • 📁ChatGPT PDF files
    • 📁AR Tag Dictionary
    • ⚙️Technical Specifications
Powered by GitBook
On this page
  • Repeat n-times
  • Repeat (true-false)
  • Customized repeat
  • Specific function for each term of a list
  • Break-out
  1. Blockly Elements
  2. Basic Blocks

Loops

Last updated 1 year ago

The Loop folder in Blockly contains blocks that are used to repeat a block of code multiple times. This can be useful for tasks such as iterating over a list, performing a calculation multiple times, or waiting for a certain amount of time.

To use a loop function, simply connect the block of code that you want to repeat to the loop function. Then, specify the condition for the loop function, or the number of times that you want the loop function to repeat.

Repeat n-times

This block allows the user to repeat some statements a certain amount of times. You can intuitively choose the number of times and the actions of the robot.

Repeat (true-false)

This block has two options: while and until.

If it is set to "while", the robot will repeat the statement set in the "do-gap" while the condition set is true.

If it is set to "until", the robot will repeat the statement set in the "do-gap" while the condition set is false.

Customized repeat

This block allows you to customize your own "repeat". In fact, you can choose the variable to use. Take it on the values from the start number to the end number, counting in specified intervals.

When the variable will have the same value as the end value the block will give a false output and will stop the execution, it means that while the condition is verified Misty will keep doing her actions.

Specific function for each term of a list

Lists in Blockly are ordered collections of items. They can be used to store any type of data, including numbers, strings, and even other lists. We'll explore this element of the programming on the dedicated page.

This block will do a specific action for each term of the list. In the "list-gap" you can insert the name of the list and under, in the "do-gap", the actions.

Break-out

This block can only be used inside a loop.

You can use the break-out of the containing loop when the user wants to stop the loop early. This can be for a variety of reasons, such as:

  • You have found what you were looking for.

  • The loop has reached a certain condition.

Otherwise, you can select "continue with the next iteration". In this case, you will skip the rest of the loop and the program will continue with the next iteration.

This can be for a variety of reasons, such as:

  • You have already done what you needed to do in the current iteration.

  • The current iteration does not meet the user criteria.

🔁
loops blocks
repeat n-times block
repeat block
customized repeat block
specific function for each term of a list block
break out block