about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2025-03-25 19:44:20 +0300
committerNakidai <nakidai@disroot.org>2025-03-25 19:44:20 +0300
commitb9391202e6eed893e0c1e6969ac375df2878a025 (patch)
tree8971179655848afcb4f9e824607d4cf5666d36f0
parentdaec1746288490bb5ba515bb8cea3a8a3ae92b46 (diff)
download3cl-b9391202e6eed893e0c1e6969ac375df2878a025.tar.gz
3cl-b9391202e6eed893e0c1e6969ac375df2878a025.zip
Add example to README
-rw-r--r--README18
-rw-r--r--README.720
2 files changed, 38 insertions, 0 deletions
diff --git a/README b/README
index cfc9fd8..2b6df00 100644
--- a/README
+++ b/README
@@ -7,6 +7,24 @@ DESCRIPTION
      3cl is an interpreter of cool char lang which is a brainfuck-like
      langauge, but different and with more features.
 
+EXAMPLES
+	   F {
+	       / define some local variables to work with
+	       &a &b &c
+
+	       / if the parameter is either 0 or 1,
+	       / return with it
+	       c? #; $c+ = c
+	       c? #;
+
+	       / otherwise, get 2 previous numbers
+	       / of a sequence and sum them
+	       = c $c $c
+	       - @F = a
+	       -- @F = b
+	       $a $b*
+	   }
+
 SEE ALSO
      3cl(1), ccl(7), Original implementation:
      https://github.com/holy-8/cool_char_lang
diff --git a/README.7 b/README.7
index 41f340d..5aee278 100644
--- a/README.7
+++ b/README.7
@@ -14,6 +14,26 @@ which is a brainfuck-like langauge,
 but different
 and with more features.
 .
+.Sh EXAMPLES
+.Bd -literal -offset indent
+F {
+    / define some local variables to work with
+    &a &b &c
+
+    / if the parameter is either 0 or 1,
+    / return with it
+    c? #; $c+ = c
+    c? #;
+
+    / otherwise, get 2 previous numbers
+    / of a sequence and sum them
+    = c $c $c
+    - @F = a
+    -- @F = b
+    $a $b*
+}
+.Ed
+.
 .Sh SEE ALSO
 .Xr 3cl 1 ,
 .Xr ccl 7 ,