aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/colorful/colorful.tm2
-rw-r--r--examples/tomodeps/tomodeps.tm6
-rw-r--r--examples/wrap/wrap.tm8
3 files changed, 8 insertions, 8 deletions
diff --git a/examples/colorful/colorful.tm b/examples/colorful/colorful.tm
index d64afe6e..d878b662 100644
--- a/examples/colorful/colorful.tm
+++ b/examples/colorful/colorful.tm
@@ -28,7 +28,7 @@ func main(texts:[Text], files:[Path]=[], by_line=no)
for i,text in texts
colorful := Colorful.from_text(text)
colorful.print(newline=no)
- if i == texts.length say("")
+ if i == texts.length then say("")
else say(" ", newline=no)
if texts.length == 0 and files.length == 0
diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm
index 1aafa6bd..1181f2be 100644
--- a/examples/tomodeps/tomodeps.tm
+++ b/examples/tomodeps/tomodeps.tm
@@ -74,13 +74,13 @@ func _printable_name(dep:Dependency -> Text)
func _draw_tree(dep:Dependency, dependencies:{Dependency=|Dependency|}, already_printed:@|Dependency|, prefix="", is_last=yes)
if already_printed.has(dep)
- say(prefix ++ (if is_last "└── " else "├── ") ++ _printable_name(dep) ++ " $\x1b[2m(recursive)$\x1b[m")
+ say(prefix ++ (if is_last then "└── " else "├── ") ++ _printable_name(dep) ++ " $\x1b[2m(recursive)$\x1b[m")
return
- say(prefix ++ (if is_last "└── " else "├── ") ++ _printable_name(dep))
+ say(prefix ++ (if is_last then "└── " else "├── ") ++ _printable_name(dep))
already_printed.add(dep)
- child_prefix := prefix ++ (if is_last " " else "│ ")
+ child_prefix := prefix ++ (if is_last then " " else "│ ")
children := dependencies[dep] or ||
for i,child in children.items
diff --git a/examples/wrap/wrap.tm b/examples/wrap/wrap.tm
index c539a0ea..303393ee 100644
--- a/examples/wrap/wrap.tm
+++ b/examples/wrap/wrap.tm
@@ -41,19 +41,19 @@ func wrap(text:Text, width:Int, min_split=3, hyphen="-" -> Text)
while not _can_fit_word(line, letters, width)
line_space := width - line.length
- if line != "" line_space -= 1
+ if line != "" then line_space -= 1
if min_split > 0 and line_space >= min_split + hyphen.length and letters.length >= 2*min_split
# Split word with a hyphen:
split := line_space - hyphen.length
split = split _max_ min_split
split = split _min_ (letters.length - min_split)
- if line != "" line ++= " "
+ if line != "" then line ++= " "
line ++= ((++: letters.to(split)) or "") ++ hyphen
letters = letters.from(split + 1)
else if line == ""
# Force split word without hyphenation:
- if line != "" line ++= " "
+ if line != "" then line ++= " "
line ++= (++: letters.to(line_space)) or ""
letters = letters.from(line_space + 1)
else
@@ -63,7 +63,7 @@ func wrap(text:Text, width:Int, min_split=3, hyphen="-" -> Text)
line = ""
if letters.length > 0
- if line != "" line ++= " "
+ if line != "" then line ++= " "
line ++= (++: letters) or ""
if line != ""