Emojicode: Difference between revisions
No edit summary |
No edit summary Β |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[File:Emoji3.PNG]] | |||
= Emojicode Workshop = | = Emojicode Workshop = | ||
Line 144: | Line 145: | ||
Β Β π | Β Β π | ||
== File Read == | == Infinate File Read == | ||
Β π¦ files π΄ | |||
π | Β π π | ||
π error π | Β Β π π π | ||
Β Β Β π₯ fileData π©ππ π€earth.txtπ€ π | |||
π | Β Β Β Β π΄π πͺπ€Read π€ π‘ π fileData 10 π€ bytesπ€ πͺ | ||
Β Β Β Β π¦ lines π« πΊ π‘ fileData π€βnπ€ | |||
Β Β Β Β π line lines π | |||
Β Β Β Β Β π line | |||
Β Β Β Β Β π©β²π 1000000 | |||
Β Β Β Β π | |||
Β Β Β π | |||
Β Β Β π error π | |||
Β Β Β Β π π€π’ Could not read fileπ€ | |||
Β Β Β π | |||
Β Β π | |||
Β π | |||
Β | |||
[[Category:Tools]] |
Latest revision as of 19:45, 5 January 2020
Emojicode Workshop
Install
Get Emojicode from the USB stick.
$ cd /Volumes/KINGSTON/Emojicode-0.5.1-Darwin-x86_64
$ ./install.sh
$ export PATH=$PATH:$HOME/emojicode/bin
$ sudo ln -s /Users/mac/emojicode/EmojicodePackages /usr/local/EmojicodePackages
About
Emojicode is an open-source, full-blown programming language consisting of emojis.
Workshop
Please note that lines that begin with $, should be executed with the Terminal and are NOT program syntax. This workshop also assumes you have completed the Emojiterm workshop. The $ should not be pasted in the terminal.
All other code blocks should be considered valid Emojicode syntax.
Create a file.
$ π myprog.emojic
The simplest Emojicode program looks as follows.
π π π
To save and exit the text editor (nanoπ), first do Cntl+O, and then Cntl+X.
You can run it by first compiling it.
$ emojicodec myprog.emojic
Running it.
$ emojicode myprog.emojib
This program is so simple, it doesn't do anything.
The famous "Hello world!" example.
π π π π€Hello world!π€ π
Making a variable...first the "frozen" type. Frozen means you can never change it. Here we make a variable called "a"
π¦ a 10
You can also compare two numbers with this program.
π π π¦ a 10 π¦ b 4 π βΆοΈ a b π π π€a is bigger than bπ€ π π
User input.
π π π¦ input π·π‘π― π€Ask something here?π€ π πͺπ€You said: π€ inputπͺ π
Convert integers to strings and back.
ππ π¦ a πΊ π π€9π€ 10 π βΆοΈ a 0 π π π€a is bigger than 10π€ π π‘ a 10 π π
Lists, make an empty list, add a 2 items (China, Nederland) print them in a loop.
π π π¦ list π· π¨ππ‘ πΈ π» list π€Chinaπ€ π» list π€Nederlandπ€ π str list π π str π π
Initialize an a list when you create it (this code does the same as what is above.
π π π¦ list π¨π€Chinaπ€ π€Nederlandπ€π π str list π π str π π
Dictionaries, add items.
π π π¦ dict π· π―ππ‘ πΈ π· dict π€Jamesπ€ π€USAπ€ π· dict π€Minhongπ€ π€δΈε½π€ π· dict π€Anjaπ€ π€Deutschlandπ€ π πͺπ‘ π dict 10 π€ items in the dictionaryπ€πͺ π
Initialize the dictionary when you make it, and look up a value.
π π π¦ dict π― π€Jamesπ€ π€USAπ€ π€Minhongπ€ π€δΈε½π€ π€Anjaπ€ π€Deutschlandπ€ π π¦ home πΊ π½ dict π€Jamesπ€ π πͺπ€James is from π€ homeπͺ π
Questionnaire Example
π π π¦ list π¨ π€Ask question 1?π€ π€Ask question 2?π€ π€Ask question 3?π€ π€Ask question 4?π€ π€Ask question 5?π€ π€Ask question 6?π€ π€Ask question 7?π€ π€Ask question 8?π€ π€Ask question 9?π€ π€Ask question 10?π€ π π str list π π¦ input π·π‘π― str π πͺπ€You said: π€ inputπͺ π π
Infinate File Read
π¦ files π΄ π π π π π π₯ fileData π©ππ π€earth.txtπ€ π π΄π πͺπ€Read π€ π‘ π fileData 10 π€ bytesπ€ πͺ π¦ lines π« πΊ π‘ fileData π€βnπ€ π line lines π π line π©β²π 1000000 π π π error π π π€π’ Could not read fileπ€ π π π