;; -*- mode:lisp; package:com.informatimago.languages.linc.c -*-

(include <stdio.h> <stdlib.h>)

(define-function main ((argc int) (argv (pointer (pointer char)))) int

    (let ((i int 0))

      (while (< i 10)
        (goto start1)
        (+= i 2)
        (label start1)
        (++ i)
        (printf "i = %d\n" i)
        (if (< 5 i)
            (break)
            (continue))
        (printf "Never printed!\n"))

      (= i 0)
      (do
        (goto start2)
        (+= i 2)
        (label start2)
        (++ i)
        (printf "i = %d\n" i)
        (if (< 5 i)
            (break)
            (continue))
        (printf "Never printed!\n")
        while (< i 10))

      (= i 0)
      (for ((= i 0) (< i 10) (++ i))
        (switch i
          (case 0
            (printf "Zero\n")
            (break))
          (case (+ 1 1)
            (printf "Two\n")
            (break))
          (default
           (printf "Current %d\n" i)
           (break)))
        (if (== 0 (% i 3))
            (+= i 2)
            (+= i 3)))

      (return 0)))
ViewGit