Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 924 Bytes

Syntax.md

File metadata and controls

43 lines (34 loc) · 924 Bytes

File Extension

  • Not enforced yet, but thinking about .lang.

Semicolons?

  • Yes, whitespace doesn't matter, and semicolons are the only way to signify the end of statements.

Variable Declartion

  • num x = 5;

Variable Assignment

  • Can reassign the value of variables with x = 2;
  • Can increment with x += 2;

Types

  • num: Integer
  • list: List
  • string: String

String

  • Can use either " or '.
  • Can convert any type to string with myInt.toString()

List

  • Declare with list[num] myList = [1, 2, 3] (can also declare as empty)
  • Access element with myList.get(0)
  • Add element with myList.add(4)
  • Modify element with myList.set(0, 1234)
  • Get length with myList.length()

Loops

  •   while(count < 10) {
          count += 1;
      }
    
    

Math

  • +: Addition
  • -: Subtraction
  • *: Multiplication
  • /: Division

Comments

  • #: Single-line comment