VPL basic – data and variables
Young Joon Kimhttp://www.helloapps.com
MSRDS First Beginner Course – STEP6
2
Topics
• Procedure for VPL Programming
• Data and variable activities
• Defining variable
• Reading variable
• Displaying your name
• Input data
• Manipulate data with “Calculate”
3
VPL
• Visual Programming Language
– Easy programming tool for novices and students
• Easy to start
• Easy to learn
• Easy to skill up
– Draw logics
– Provide intuitive and understandable flow
– Applicable for most S/W development area
4
Procedure for VPL
programming
5
Procedure for VPL programming
• Step1: Add activities or services
Add activities
Add services
6
• Step2: Set values
Procedure for VPL programming
Set values
7
• Step3: Connect each activity or service
Procedure for VPL programming
Connect
8
• Step4: Connect functions
Procedure for VPL programming
9
• Step5: Connect data for each item
Procedure for VPL programming
10
Procedure for VPL programming
• Step6: Save and run a diagram
11
Procedure for VPL programming
• Step7: Check the result
12
Procedure for VPL programming
• Check log data
Log data
13
Procedure for VPL programming
• Stop VPL running
14
Data and variable activities
15
Data and variable activities
• Data activity
– Define constant values
– Can’t be modified
• Variable activity
– Keep the values
– Can be modified
16
Adding “Data” activity
• Double click “Data” activity or drag and drop
• Select data type
• Input data
1
2
3
Double-click
Select data type
Input default value
17
• Double click “Variable” activity or drag and drop
Adding “Variable” activity
Double-click
18
Defining variable
19
Defining variable
• Click “…” icon
Click icon
20
• Add variable
• Change name
• Select variable type
Defining variable
Click
Change name Click
Select type
Click
1
2
3
21
• Assign value to the variable
Defining variable
Connect
22
• Select “SetValue” item
Defining variable
23
Defining variable
• Assigned value
24
Reading variable
25
Reading variable
• Use “Calculate” activity
Double-click
26
Reading variable
• Connect “Variable” and “Calculate” activities
Connect
27
Reading variable
• Select “state” item from the list
28
Reading variable
• Add “.”
• Select “a” item from the list
Add “.”
Select “a”
1
2
29
Reading variable
• Add a “Simple Dialog” service
Double-click
30
Reading variable
• Connect “Calculate” and “Simple Dialog” service
31
Reading variable
• Select “AlertDialog” function
32
Reading variable
• Select “value” item from the left list
33
Reading variable
• Save and run diagram
34
Reading variable
• Execution result
35
Displaying your name
36
Displaying your name
• Prepare below diagrams
37
Displaying your name
• Connect “Data” and “Calculate” activities
38
Displaying your name
• Type below text in the “Calculate” box
– “My name is “ + value
39
Displaying your name
• Connect “Calculate” and “Simple Dialog”
40
Displaying your name
• Select “AlertDialog”
• Select “value”
41
Displaying your name
• Save and run diagram
42
Displaying your name
• Execution result
44
Input data
• Add “Data” and set below text
– “Input your name: “
• Add a “HelloApps Console” service
Double-click
Double-click
1
2
3
45
Input data
• Connect “Data” and “Console”
• Select “Write”
• Select “value”
1
2
3
46
Input data
• Copy and paste “HelloAppsConsole” service
• Connect first “Console” and second “Console” service
• Select “ReadLine” function
2
3
1Copy firstConsole service
47
• Copy and paste “HelloAppsConsole” service
• Connect second “Console” and third “Console” service
• Select “WriteLine” function
Input data
1Copy firstConsole service
2
3
4
48
Input data
• Save and run diagram
49
• Execution results
Input data
Type your name
50
Manipulate data with
“Calculate”
51
• Add “Calculate” activity
• Type “My name is “ +
Manipulate data with “Calculate”
1Add “Calculate”
2
52
Manipulate data with “Calculate”
• Select “Value” from the list
53
Manipulate data with “Calculate”
• Connect “Calculate” and “Console”
54
Manipulate data with “Calculate”
• Select “WriteLine” function
• Select “value” data
55
Manipulate data with “Calculate”
• Save and run diagram
56
Manipulate data with “Calculate”
• Execution results
Type your name