+ All Categories
Home > Technology > MemeScript Language

MemeScript Language

Date post: 22-May-2015
Category:
Upload: memeapps
View: 1,961 times
Download: 2 times
Share this document with a friend
Description:
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/
Popular Tags:
39
102 - MemeScript Prerequisites 101 - Hello Meme IDE introduction to
Transcript
Page 1: MemeScript Language

102 - MemeScript Prerequisites

101 - Hello Meme IDE

introduction to

Page 2: MemeScript Language

Contents

1

2 MemeScript Example3 Meme IDE Function Editor4 Primitive Types5 Declaring Integer Variables6 Declaring Decimal Variables7 Declaring Boolean Variables8 Declaring Strings9 Default Initializations10 Pre-defined Complex Types11 IF 12 IF/ELSE13 IF/ELSEIF/ELSE14 WHILE15 FOR16 Arithmetic17 Logical Operations18 Dataspace19 Defining a ‘Person’ Record20 Adding Attributes to the ‘Person’ Record

21 Naming Conventions22 Defining an Address Record23 Adding List of Addresses to Person24 Creating a Person Record25 ‘Dot’ Notation26 String Concatenation27 String Comparison28 String Utilities29 Collections30 INSERT31 Collections and {}32 Removing from a Collection33 Date and Time Types34 Date and Time Arithmetics35 Date and Time Utilities36 Date Formatting37 Time Formatting38 Other Free Tutorials

Page 3: MemeScript Language

MemeScript Example var x = 10;

var y = 20;

var z : Integer;

z = x + y;

notify(z);

2

Page 4: MemeScript Language

Meme IDE Function Editor

3

Page 5: MemeScript Language

Primitive Types•Integer 10, -234

•Decimal 1.23

•String “ABC”

•Boolean true, false

4

Page 6: MemeScript Language

Declaring Integer VariablesLocal variables within functions

var x : Integer;

var x2 = 1;

5

Page 7: MemeScript Language

Declaring Decimal Variablesvar d : Decimal(2);

var d2 = 1.23;

6

Page 8: MemeScript Language

Declaring Boolean Variablesvar b : Boolean;

var b2 = true;

7

Page 9: MemeScript Language

Declaring Stringsvar s : String;

var s = “abc”;

8

Page 10: MemeScript Language

Default Initializations•String - empty string “”

•Integer and Decimal – 0

•Boolean – false

9

Page 11: MemeScript Language

Pre-defined Complex Types• Date – day, month, year

• Time – hour, minute, second

• Duration – hour, minute, second

• Timestamp

10

Page 12: MemeScript Language

IFvar a = 15;if (a > 10){ notify(“A is big”);}

11

Page 13: MemeScript Language

IF / ELSEvar a = 15;if (a > 10){ notify(“A is big”);}else{ notify(“A is small”);}

12

Page 14: MemeScript Language

IF / ELSEIF / ELSEvar a = 15;if (a > 10){ notify(“A is big”);}elseif (a > 5){ notify(“A is medium sized”);}else{ notify(“A is small”);}

13

Page 15: MemeScript Language

WHILEvar x = 0;while (x < 10){ x++; // do other things}

14

Page 16: MemeScript Language

FORvar names : String[];append(names, “Simon”);append(names, “Graham”);append(names, “Joe”);for (name in names){ notify(name);}

15

Page 17: MemeScript Language

Arithmeticvar c = 20;f = c * (9.0 / 5.0) + 32;notify(f);

16

Page 18: MemeScript Language

Logical Operatorsvar x = 10;if ((x > 10) and not (x > 20)){ notify(“x is middle sized”);}

17

Page 19: MemeScript Language

18

Dataspace

Page 20: MemeScript Language

19

Defining a ‘Person’ Record

Page 21: MemeScript Language

20

Adding Attributes to the ‘Person’ Record

Page 22: MemeScript Language

Naming ConventionsRecord 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

21

Page 23: MemeScript Language

22

Defining an Address Record

Page 24: MemeScript Language

23

Adding List of Addresses to Person

Page 25: MemeScript Language

Creating a Person Recordvar p : Person;var a : Address;a.line1 = “12 High St”;a.zip = “PA 12345”;p.name = “Simon”;p.tel = “1234567”;append(p.addresses, a);

24

Page 26: MemeScript Language

‘Dot’ Notationnotify(p.addresses[0].line1);

p.addresses[0].line1 = “13 High St”

25

Page 27: MemeScript Language

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.

26

Page 28: MemeScript Language

String Comparisonvar s1 = “String 1”;var s2 = “String ONE”;if (s1 == s2){ notify(“Yes”);}

27

Page 29: MemeScript Language

String Utilities• Boolean startsWith(sourceString, matchString)

• Boolean endsWith(sourceString, matchString)

• String subString(sourceString, startPos, length)

• Integer size(sourceString)

• String toLower(sourceString)

• String toUpper(sourceString)

• String trim(sourceString)

• String replaceAll(sourceString, matchString, replacementString)

• String replaceFirst(sourceString, matchString, replacementString)

• String replaceLast(sourceString, matchString, replacementString)

28

Page 30: MemeScript Language

Collectionsvar people : Person[];var names : String[];append(names, “Simon”);append(names, “Graham”);

29

Page 31: MemeScript Language

INSERTvar people : Person[];var names : String[];append(names, “Simon”);append(names, “Graham”);insert(names, “Joe”, 0);

30

Page 32: MemeScript Language

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);

31

Page 33: MemeScript Language

Removing from a Collectionvar 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);

32

Page 34: MemeScript Language

Date and Time Types• Date - day, month, year• Time - hour, minute, second• Duration - hour, minute, second• Timestamp

33

Page 35: MemeScript Language

Date and Time Arithmeticvar t : Time;t = timeNow();

var dt : Duration;dt.hour = 1;t = addTime(t, dt);

34

Page 36: MemeScript Language

Date and Time Utilities• dateNow()• timeNow()• setDate(Date, year, month, day)• setTime(Time, hour, min, sec)• addDays(Date, days)• dayOfWeek(Date)• monthOfYear(Date)• formatDate(Date, formatString)• formatTime(Time, formatString)• formatTimestamp(Timestamp, String)

35

Page 37: MemeScript Language

Date Formatting

36

var today : Date;today = dateNow();formatDate(today, “mmm d, yyyy”);

“January 1, 2011”

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”

Code Description Result

Page 38: MemeScript Language

Time Formatting

var t : Time;t = timeNow();formatTime(t, “HH:MM:SS PP”);

“12:34:10 am”

HHH Hour in 24 hour format with leading zero 19HH Hour in 24 hour format with leading zero 08H Hour in 12 hour format without leading zeros 8MM Minute with leading zero 05M Minute without leading zero 5SS Seconds with leading zero 09S Seconds without leading zero 9PP am/pm indicator am

Code Description Example Result

37

Page 39: MemeScript Language

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 Language103 - Meme IDE Fundamentals

201 - Records and Record Types202 - Designing Business Apps203 - Advanced MemeScript

301 - MemeApps and Communications302 - MemeApps advanced User Interfaces303 - MemeApps and Persistence

38


Recommended