Difference between revisions of "Emojicode"

From Hackers and Designers
Jump to navigation Jump to search
 
Line 1: Line 1:
[[Category:Tutorials]]
[[File:Emoji3.PNG]]
[[File:Emoji3.PNG]]
= Emojicode Workshop =
= Emojicode Workshop =
Line 164: Line 163:
     🍉
     🍉
   🍉
   🍉
[[Category:Tools]]

Latest revision as of 20:45, 5 January 2020

Emoji3.PNG

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🔤
      🍉
    🍉
  🍉