First Program
Saying Hello

The typical way to start with a programming language tutorial is with the Hello world program:
print "Hello world!"
As you can see, in Mint printing Hello world! to the screen is very simple and only requires 1 line of code.
Many programming languages such as C++ and Java cannot easily perform the Hello world program in only 1 line. Others, such as Python and Ruby, can.

To run this program, edit the file program.mint in your Mint directory and then double-click on the RunMint.bat batch file to execute the Mint interpreter.

If this doesn't work, you may need to find your Java installation and edit the RunMint.bat file accordingly. Usually, Java is installed somewhere like C:/Program Files/Java/jre7/bin/java.exe. Edit the RunMint.bat file in Notepad so that it looks like this:
@echo off
title Mint
"C:/Program Files/Java/jre7/bin/java.exe" -jar Mint.jar
echo [Program Finished.]
pause
And now your mint programs should run properly.

To execute a Mint program that is not named program.mint, go to the command line and type:
"C:/Program Files/Java/jre7/bin/java.exe" -jar Mint.jar NAME_OF_FILE.mint
To execute NAME_OF_FILE.mint. Make sure you cd (change directory) into the folder that contains the Mint interpreter before doing so.

Let's write some more code:
print 300
print 36 * (8 + 14)
print "My name is " + "Alice."
a = 100 / 3
print a
b = a + 87
print b
Mint can perform mathematical operations such as 36 * (8 + 14), where * means multiplication and + means addition. Text operations are also possible, with + meaning 'combine these two pieces of text'.

You are also allowed to assign variables in Mint, using the format:
<name> = <value>
Which assigns the value <value> to a variable named <name>.

You can also use the keyword 'input' to allow the user to type in information:
show "Enter your name:"
stuff = input
print "Your name is: " + stuff
'show' is similar to print, except that it doesn't display a line break on the screen.

Comments are used to provide notes and useful info about code. The interpreter ignores all comments.
There are two types of comments: line comments (that start with //) and block comments (that start with /* and end with */).
//This is a line comment.

/* This is
a block comment */
To close up this introductory lesson, there is also a very handy Mint Read-Eval-Print-Loop,
which acts similarly to the command-line Python interpreter.

Image Error

By default, program.mint contains a Photon Mint program that activates the Read-Eval-Print-Loop.
Simply click on RunMint.bat to start if you have not edited program.mint yet.

Navigation
Previous Lesson: Preparations
Next Lesson: Operators
Table of Contents