Variables Scope

In this chapter we are going to learn about the Variables Scope

Introduction

We can create this program quickly using the Quick Start component

ib_quickstart_variablesscope.png

Program Steps

After selecting the (Variables Scope) template, we will get the next steps in the Goal Designer

gd_quickstart_variablesscope.png

Creating the Program

To create this program we will use the next components

  • Assignment

  • Define Function

  • Call Function

  • For Loop

  • Print Text

In the begining the Steps Tree is empty

1.png

Set x=10 using the Assignment component

2.png 3.png 4.png

Define the Main() function

5.png 6.png 7.png

Count from 1 to 10 using a For Loop

8.png 9.png 10.png

Call the mycounter() function

11.png 12.png 13.png

Define the mycounter() function

14.png 15.png 16.png

Print the X variable

17.png 18.png 19.png

Decrement the X value

20.png 21.png

Now we have the final Steps Tree in our program

22.png