How to move a block of code Pro Preview

We know the code that is dependant on operators must be indented forward, but if we decide to place 100 lines of code in an operator after it has already been written out, the indenting of each line of code separately would be a painfully lengthy process.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1634
  • 11 Jun 2020

To indent several lines of code simultaneously in VS-Code, you simply need to mark the lines you wish to indent and press "tab". Semi-marked lines will also be completely indented.

The first of the three marked lines in this example is not entirely marked:

ev3.speaker.beep()
left_motor.run(1000)
right_motor.run(1000)
wait(2000)

However, if you press tab, all three lines  will be indented:

ev3.speaker.beep()
    left_motor.run(1000)
    right_motor.run(1000)
    wait(2000)

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Python with LEGO Mindstorms EV3 - Level 2
  • 39
  • 19:58
  • 93
Image for Lesson 2 - Grabber control panel
  • 6
  • 6
  • 7
  • 3d_rotation 2