Compare length of two strings: Difference between revisions

Added Quackery.
(Added Quackery.)
Line 1,034:
"abcdef" has length 6 and is neither the longest nor the shortest string
"abcd" has length 4 and is the shortest string
</pre>
 
=={{header|Quackery}}==
 
<lang Quackery> $ "A short string of"
$ "A slightly longer string of"
2dup size dip size > if swap
dup echo$ sp size echo say " characters." cr
dup echo$ sp size echo say " characters." cr cr
 
' [ $ "From troubles of the world I turn to ducks,"
$ "Beautiful comical things"
$ "Sleeping or curled"
$ "Their heads beneath white wings"
$ "By water cool,"
$ "Or finding curious things"
$ "To eat in various mucks"
$ "Beneath the pool," ]
[] swap witheach [ do nested join ]
sortwith [ size dip size < ]
witheach [ echo$ cr ] </lang>
 
{{out}}
 
<pre>A slightly longer string of 27 characters.
A short string of 17 characters.
 
From troubles of the world I turn to ducks,
Their heads beneath white wings
Or finding curious things
Beautiful comical things
To eat in various mucks
Sleeping or curled
Beneath the pool,
By water cool,
</pre>
 
1,493

edits