Conditional structures: Difference between revisions

Content added Content deleted
(Add Ed conditionals)
Line 2,501: Line 2,501:
print i & " is not divisible by 2 or 3"
print i & " is not divisible by 2 or 3"
.
.
</syntaxhighlight>

=={{header|Ed}}==

Note that ed, unlike more advanced [[Sed]] has no conditional branching. Still, conditionals can be simulated with global match/no-match rules:

<syntaxhighlight lang="bash">
g/True/s//It's true!/p
v/True/s/.*/It's false!/p
</syntaxhighlight>
</syntaxhighlight>