Skip to content

5) Example Programs (Cont.)

Rachel Rivera edited this page Jan 22, 2015 · 1 revision

Comments

## Two octothorpes allow for multi-line 
comments in TeaScript ##

# One octothorpe is used for single line comments

A Simple Program

## function that prints fibonacci 
numbers up to the given max ##  
print_fib := (max) ->
  # multiple assignment allowed through tuple packing/unpacking
  a, b = 1, 1  
  while b < max :
    out(x)
    a, b = b, a+b
  end
end