Phrase reversals: Difference between revisions

Applesoft BASIC
(Applesoft BASIC)
Line 478:
</pre>
 
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="basic"> 10 PHRA$ = "rosetta code phrase reversal"
20 GOSUB 100
30 PRINT PHRA$(0)
40 PRINT PHRA$(1)
50 PRINT PHRA$(2);
60 END
100 FOR PH = 0 TO 6
110 PH$(PH) = ""
120 NEXT PH
130 FOR PH = 0 TO LEN (PH$)
140 PH$(4) = MID$ (PH$,PH + (PH < 255),PH < 255)
150 PH$(0) = PH$(4) + PH$(0)
160 IF PH$(4) = " " THEN GOSUB 200
170 PH$(5) = PH$(5) + PH$(4)
180 PH$(6) = PH$(4) + PH$(6)
190 NEXT PH
200 PH$(1) = PH$(1) + PH$(3) + PH$(6)
210 PH$(2) = PH$(5) + PH$(3) + PH$(2)
220 PH$(3) = " "
230 PH$(4) = ""
240 PH$(5) = ""
250 PH$(6) = ""
260 RETURN</syntaxhighlight>{{out}}
<pre>
lasrever esarhp edoc attesor
attesor edoc esarhp lasrever
reversal phrase code rosetta</pre>
=={{header|Batch File}}==
<syntaxhighlight lang="dos">@echo off
413

edits