segunda-feira, 18 de novembro de 2019

Beginning at MiniScript

This blog, as the name says, is about Mini Script, a relatively new programming language. I made this blog because i realized that in the web, currently, there is no videos or blogs teaching Mini Script. So my goal, in this blog, is introduce YOU to the Mini Script language. Even i am starting, so for now i'll just tell the basic. Also, there's already a nice tutorial at this page, where you can run some Mini Script code.
  But let's start now. Mini Script is a very simple language. To do the famous "Hello World" example, you just have to type:
print "Hello, world!"
... and done, the program will print "Hello, world!".

  But of course you're not here just for learn how to print something. So now, i'll make a example program and tell about input and variables!


First, you must open the Try it! page or download the MiniMicro engine at https://miniscript.org/MiniMicro. I advise downloading the Mini Micro engine, since it is FREE and don't take so much space in the computer. Now we can start writing:

Our program will be very simple. It must ask what the user want him to print, then print it and store it in a variable. Let's start:

With MiniMicro


Step 1


Type:
save "test1"

Note: Substitute the "test1" by the name that you want for you project.

Step 2


Type "edit". You must to see something like the image above.

Step 3


Type:

var = ""
text = input("What must i print?")

Explaining the "var = """
"var" is the name of the variable, and the = "" is the contents of the variable, that is nothing.

Explaining the "text = input("What must i print?")
Well. Inputs are like variables, but they store what the user says. In this case, "text" is the name of the input, "= input" defines that "text" is the name of the input and the rest is just what the program will print.
Now the program already prints "What must i print?", but don't do anything more. Let's add some more code...

Step 4


 Type:

var = text
print var

Explaining the "var = text"
As i have already explained, "var" is the name of the variable and "text" is the name of the input. When we type "var = text", it means that "var" has the same contents of  "text". So, if "text" = "Hello", var is also "Hello".

Explaining the "print var"
I don't thinks it even need to be explained. It just prints the contents of the "var" variable. Now we have a simple program that asks "What must i print?", and print what the user wants.

Now, click the save button...


... and type "run". Done! If the program go wrong, verify the code, rewrite the code and try again.

With Try It!

Now, with the Try It! page. It's almost the same of the MiniMicro. It's the same code, so just do the steps 3 and 4... and done. But remember that it is just a base program. Using the same commands that this program uses you can create a lot of different things.

NOTE that we used more variables than we really need here, just to show how they work. We could have just written:

var = input("What must i print?")
print var

So, this was the first post about MiniScript. See you later!

Nenhum comentário:

Postar um comentário