Momentum Programming Language

The first computer programming language created with the sole purpose of introducing coding to beginners

Quick Links

The Source Code
Introduction to Momentum
The basics of Momentum
How to use containers
How to Print
How to use If structures
How to use Change Structures
How to do Loops
How to get Input
How to use Object Oriented Programming

Introduction

Many beginner programmers have been told to begin coding with Scratch from MIT. However, after Scratch, where do beginners go from there? Python and JavaScript are very overwhelming at first, and Java and the C languages have too much object oriented structure to accomodate beginner coders. The Momentum Programming Language successfully bridges this gap between block/drag and drop coding and complex programming.

Momentum: The Basics

Like Java, Momentum also uses a ending character at the end of each piece of code. In Java, the coder puts a semicolon, but in Momentum, we use a smiley face, ":)". The base syntax in Momentum is that every single line of code starts with 4(add input and loops) specific words:
-Container: a container that can hold text, numbers, characters, etc.
-If statements: used when the coder wants to run certain lines of code only if a condition is true
-Loop: used when the coder wants to repeat certain lines of code until a certain condition is false
-Print: used to print text to the command line

The Container Tag

Containers have the following syntax

Container DATATYPE name = value :)

In order to make Containers, we must specify by using the keyword Container, so this will always be Container.
Next is the DATATYPE, which should be in all lowercase, which can be any of the following:

-number: represents a number, integer or decimal
-cond:represents either true or false
-text:represents English words and characters
-letter:represents a letter in the English alphabet

Next is the name, which is what you want to call the Container.
The equal sign sets whatever is on the left hand side to whatever is on the right hand side.
The value is what the Container should store.

Example container creations:

Container number num1 = 3 :)
Container number num2 = 3.4 :)
Container text str = "hello" :)
Container letter char = 'a' :)
Container cond bool = true :)

The Print Tag

The print tag is used to print text to the command line.
The print structure syntax is as follows:

Print TEXTCONTAINERNAME :) OR Print "TextToBePrinted" :)

As before, Print must start the line in order to signify that the print structure is being used.
The text to be printed can either be stored inside the container
Then, the smiley face is used to end the statement.
Examples of the Print structure:

Container text str = "Example text container":)
Print str:)
These lines of code will print "Example text container"

Container

The If Tag

If statements are used when the coder wants to run certain lines of code when a condition is true.
The if statement syntax in Momentum goes as such:

If condition {
statement:)
}:)
The If must start the line to signify the if structure.
The condition can be a container of type cond or just a bare cond expression, such as 3>4.
The brackets signify the start of the code to be run assuming the condition is true.
The statement is the code to be run when the cond is true.
Here are some examples of If structures.

if 4>3 {
Print "This will print":)
}:)
if 3>4 {
Print "This will not print":)
}:)

The Change Tag

The change structure is the most complex of all of the structures, having different capabilities for each data structure.
The syntax is as follows:

Change CONTAINERNAME OPERATOR PARAM:)

Change is necessary, as that is the structure.
Containername is the name of the container.
The Container being changed's type is crucial to the operators available to be called. See below chart.

One important thing to know is that the param can never be a container, only a hard coded value.

Change with texts

When the Container being changed is a text, the available operators are += and =.

+=: This operator with text will attach both texts together.
Example: Container text str = "Water":)
Change str += "Bottle":)
Now str holds a text:"WaterBottle"

=: This operater with text will put the text parameter into the text container.
Example: Container text str = "thiswontexistsoon":)
Change str = "newtext":)
Now str holds the text "newtext"

Change with numbers

Numbers have the most operators by far, as when the containor is a number, the operators available are =, +=, -=, *=, /=.

=: This operator with numbers will put the number parameter in to the number containor being changed.
Example: Container number num = 3:)
Change num = 7:)
Now num holds 7.

+=: This operator will add the number parameter to the number container.
Example: Container number num = 3;
Change num += 6:)
Now, num has 9, which is 3 + 6.

-=: This operator will subtract the number parameter from the number container.
Example: Container number num = 3;
Change num -= 6:)
Now, num has -3, which is 3 - 6.

*=: This operator will multiply the number parameter to the number container.
Example: Container number num = 3;
Change num *= 6:)
Now, num has 27, which is 3 * 6.

/=: This operator will divide the number parameter by the number container.
Example: Container number num = 3;
Change num /= 6:)
Now, num has .5, which is 3 / 6.

Change with conds

Conditions only have one operator, which is =.

=: Sets the container being changed to the param cond.
Example: Container cond bool = true:)
Change bool = false:)
Now bool is false.

Change with letters

Letters are very similar to conditions in the sense that they only have one operator, the = operator.

=: Sets the letter container equal to the letter param.
Example: Container letter grade = 'a':)
Change grade = 'b':)
Now grade holds the letter b.

The Loop Tag

Yet to be implemented

The Input Tag

Yet to be implemented

Object Oriented Programming

Yet to be implemented

Will become momentumcode.tech once available