This is the downloadable development resource shown in the video tutorial 102- Introduction to MemeScript. For any mobile app developers currently using or considering using adopting Meme IDE.
find out more
http://www.memeapps.com/
2. 1
Contents
2 MemeScript Example 21 Naming Conventions
3 Meme IDE Function Editor 22 Defining an Address Record
4 Primitive Types 23 Adding List of Addresses to Person
5 Declaring Integer Variables 24 Creating a Person Record
6 Declaring Decimal Variables 25 ‘Dot’ Notation
7 Declaring Boolean Variables 26 String Concatenation
8 Declaring Strings 27 String Comparison
9 Default Initializations 28 String Utilities
10 Pre-defined Complex Types 29 Collections
11 IF 30 INSERT
12 IF/ELSE 31 Collections and {}
13 IF/ELSEIF/ELSE 32 Removing from a Collection
14 WHILE 33 Date and Time Types
15 FOR 34 Date and Time Arithmetics
16 Arithmetic 35 Date and Time Utilities
17 Logical Operations 36 Date Formatting
18 Dataspace 37 Time Formatting
19 Defining a ‘Person’ Record 38 Other Free Tutorials
20 Adding Attributes to the ‘Person’ Record
3. 2
MemeScript Example
var x = 10;
var y = 20;
var z : Integer;
z = x + y;
notify(z);
11. 10
Pre-defined Complex Types
• Date – day, month, year
• Time – hour, minute, second
• Duration – hour, minute, second
• Timestamp
12. 11
IF
var a = 15;
if (a > 10)
{
notify(“A is big”);
}
13. 12
IF / ELSE
var a = 15;
if (a > 10)
{
notify(“A is big”);
}
else
{
notify(“A is small”);
}
14. 13
IF / ELSEIF / ELSE
var a = 15;
if (a > 10)
{
notify(“A is big”);
}
elseif (a > 5)
{
notify(“A is medium sized”);
}
else
{
notify(“A is small”);
}
22. 21
Naming Conventions
Record Type Names
• bumpy case with initial uppercase,
e.g. Person or EmployeeDetails
Attribute names in records
• bumpy case with initial lowercase
e.g. name or firstName
25. 24
Creating a Person Record
var p : Person;
var a : Address;
a.line1 = “12 High St”;
a.zip = “PA 12345”;
p.name = “Simon”;
p.tel = “1234567”;
append(p.addresses, a);
27. 26
String Concatenation
var s1 = “The Start”
var s2 = “The Middle”
var s3 = “The End”
var result = s1 + “, “ + s2 + “, “ + s3 + “. “
+ 3 + “ parts.”;
The Start, The Middle, The End. 3 parts.
30. 29
Collections
var people : Person[];
var names : String[];
append(names, “Simon”);
append(names, “Graham”);
31. 30
INSERT
var people : Person[];
var names : String[];
append(names, “Simon”);
append(names, “Graham”);
insert(names, “Joe”, 0);
32. 31
Collections and []
var people : Person[];
var fred : Person;
simon.name = “Simon”;
simon.tel = “12345”;
people.append(simon);
var graham : Person;
graham.name = “Simon”;
graham.tel = “12345”;
people.append(graham);
people.remove(simon);
33. 32
Removing from a Collection
var people : Person[];
var simon : Person;
simon.name = “Simon”;
simon.tel = “12345”;
people.append(simon);
var graham : Person;
graham.name = “Simon”;
graham.tel = “12345”;
people.append(graham);
notify(people[1].name);
34. 33
Date and Time Types
• Date - day, month, year
• Time - hour, minute, second
• Duration - hour, minute, second
• Timestamp
35. 34
Date and Time Arithmetic
var t : Time;
t = timeNow();
var dt : Duration;
dt.hour = 1;
t = addTime(t, dt);
37. 36
Date Formatting
Code Description Result
d Day of the month without leading zero “1”
dd Day of the month with leading zero “01”
ddd The localised name for the day of the week “Sunday”
m Month of the yearwithout leading zero “1”
mm Month of the year with leading zero “01”
mmm The localised short (3 letter) name for the month “Jan”
mmmm The localised full name for the month “January”
yy The year as two digits “10”
yyyy The year as four digits “2010”
var today : Date;
today = dateNow();
formatDate(today, “mmm d, yyyy”);
“January 1, 2011”
38. 37
Time Formatting
Code Description Example Result
HHH Hour in 24 hour format with leading zero 19
HH Hour in 24 hour format with leading zero 08
H Hour in 12 hour format without leading zeros 8
MM Minute with leading zero 05
M Minute without leading zero 5
SS Seconds with leading zero 09
S Seconds without leading zero 9
PP am/pm indicator am
var t : Time;
t = timeNow();
formatTime(t, “HH:MM:SS PP”);
“12:34:10 am”
39. 38
Please check www.memeapps.com for more free tutorials in the developers center
Level one:
101 - Hello World Hello Meme IDE
102 - Introduction to MemeScript Language
103 - Meme IDE Fundamentals
201 - Records and Record Types
202 - Designing Business Apps
203 - Advanced MemeScript
301 - MemeApps and Communications
302 - MemeApps advanced User Interfaces
303 - MemeApps and Persistence