From 73c6d49bb6ef0b41559f7acd5929accbb4697bc7 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Sun, 12 Aug 2012 17:13:58 -0400 Subject: Improve formatting of 'examples' sections of docs. --- doc/lang.txt | 62 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/doc/lang.txt b/doc/lang.txt index 5c90dd9..5d5f411 100644 --- a/doc/lang.txt +++ b/doc/lang.txt @@ -637,41 +637,49 @@ TABLE OF CONTENTS: 5.1. Hello World: - use std - const main = { - std.put("Hello World!\n") - -> 0 - } + use std + const main = { + std.put("Hello World!\n") + -> 0 + } + + TODO: DESCRIBE CONSTRUCTS. 5.2. Conditions - const intmax = {a, b - if a > b - -> a - else - -> b - ;; - } + use std + const intmax = {a, b + if a > b + -> a + else + -> b + ;; + } - const main = { - var x = 123 - var y = 456 - std.put("The max of %i, %i is %i\n", x, y, max(x, y)) - } + const main = { + var x = 123 + var y = 456 + std.put("The max of %i, %i is %i\n", x, y, max(x, y)) + } + + TODO: DESCRIBE CONSTRUCTS. 5.3. Looping - const innerprod = {a, b - var i - var sum - for i = 0; i < a.len; i++ - sum += a[i]*b[i] - ;; - } + use std + const innerprod = {a, b + var i + var sum + for i = 0; i < a.len; i++ + sum += a[i]*b[i] + ;; + } + + const main = { + std.put("The inner product is %i\n", innerprod([1,2,3], [4,5,6])) + } - const main = { - std.put("The inner product is %i\n", innerprod([1,2,3], [4,5,6])) - } + TODO: DESCRIBE CONSTRUCTS. 6. STYLE GUIDE: -- cgit v1.1