Say Hello program

In this chapter we are going to learn how to create the Say Hello program

The User will enter his/her name then we will print (Hello UserName)

In this lesson we will learn about

  • Variables

  • Expressions

  • Getting input using the Keyboard

  • Printing Expressions that merge between two strings

Introduction

We can create this program quickly using the Quick Start component

ib_quickstart_sayhello.png

Program Steps

After selecting the (Say Hello) template, we will get the next steps in the Goal Designer

In the Output Window, The program prints the message (Enter your name?)

After typing (Mahmoud), We see the (Hello Mahmoud) message on the Screen

gd_quickstart_sayhello.png

Creating the Program

To create this program we will use the next components

  • Comment (Optional)

  • Print Text

  • Get Input

Using the Comment component, we will add some comments to our program!

1.png

We can use the same component many times using the (Again) button

2.png

We will add more than one comment to the program

3.png

In the Interaction Page, We write the comment in the Text Field

4.png

After writing the comment, The Steps Tree will be updated!

5.png

Let’s add the other comments

6.png

We can add empty lines to the Steps Tree by having empty comment

Empty lines could be a good separator between comments

7.png 8.png 9.png 10.png 11.png

We will use the (Print Text) component

12.png 13.png 14.png

Select the (Get Input) Component

15.png

Type (cName) as the Variable Name

Variables are used to store data in the Computer Memory

Using the variable name we can set or get the variable value

16.png 17.png 18.png

Now using the (Print Text) component we will print an Expression

The Expression is a mix of Variables, Values & Operators

In this example we use the Plus operator to merge between strings

19.png

Now we have the final Steps Tree in our program

20.png