Conditional structures: Difference between revisions

Content added Content deleted
(Add Ed conditionals)
(→‎{{header|Ed}}: Fix syntax and punctuation)
Line 2,505: Line 2,505:
=={{header|Ed}}==
=={{header|Ed}}==


Note that ed, unlike more advanced [[Sed]] has no conditional branching. Still, conditionals can be simulated with global match/no-match rules:
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">
<syntaxhighlight>
g/True/s//It's true!/p
g/True/s//It's true!/p
v/True/s/.*/It's false!/p
v/True/s/.*/It's false!/p