LatteScript LatteScript

How do I use LatteScript?

To use LatteScript, simply type LatteScript code into the code area on the code tab, then click the run button. Tired of your program? You can click the stop button to prematurely end your program. The code you type into the code area is automatically saved, so there's no need to worry about accidentally losing your work if you close your browser. If you want to save a program for later, it's easy to copy and paste all of your code into a text editor like Notepad for Windows, TextEdit for Mac OS X, or Gedit for Linux. Remember, on Linux or Windows, you can type Control-A then Control-C to copy all of your code while the code area is focused, then paste it into another program later with Control-V. Mac users can accomplish this by using the Command key instead of the Control key. Alternatively, you can typically access this functionality from the right-click context menu as well.

What does LatteScript look like?

In general, LatteScript has minimal visual impact. LatteScript uses very few symbols, uses indentation to delimit blocks, and has some non-de-facto uses for certain symbols. Below is a bubble sort implemented in LatteScript.

procedure bubble_sort xs
  swapped := true
  while swapped
    swapped := false
    for i from 2 to #xs
      if xs@(i - 1) < xs@i
        swap xs, i - 1, i
        swapped := true

procedure swap xs, i, j
  temp := xs@i
  xs@i := xs@j
  xs@j := temp

xs := [3, 4, 5, 1, 2]
bubble_sort xs
print xs