Previously we learned how to assign a numerical value to a variable and use that variable in a program. The "print variable" block can be used to print out the current numerical value of a variable: The print variable block is found in the Text menu. Watch the video to learn more about how to use it. Note: Since the video was created, the way this print block works has been changed slightly. Instead of printing the result in a popup window, it opens a printing "Console" below the Workspace and displays the printed result there. (Click the "Console" button next to the "Show Ch" button to toggle the Console open or closed.) This change allows us to see the results of multiple print commands at the same time in the Console, instead of one at a time as was the case with the popup window shown in the video. The other change to note is the addition of a "\n" in the print block, as seen above. The "\n" tells RoboBlockly to start a new printing line at that point ("\n" standing for "newline").
|
Set a variable named "distance" to the value 22. Drive the robot forward using that variable in a driveDistance block. Finally, use the "print variable" block to print "distance is 22 The robot drove 22 units forward." |
Grid Size: S M L | Simple View: | MinView: |
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
(
,
in
) in
|
|
![]() |
|
|
|||||||||||
|
|||||||||||