Exactly three adjacent 3 in lists: Difference between revisions
→{{header|Wren}}: Simplified both versions.
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: fixed bug, added test case) |
(→{{header|Wren}}: Simplified both versions.) |
||
Line 664:
=={{header|Wren}}==
{{libheader|Wren-seq}}
<lang ecmascript>
var lists = [
[9,3,3,3,2,1,7,8,5],
[5,2,9,3,3,7,8,4,1],
Line 676 ⟶ 679:
System.print("Exactly three adjacent 3's:")
for (list in lists) {
var
System.print("%(list) -> %(condition)")
}</lang>
Line 697 ⟶ 695:
[3, 3, 3, 3, 3, 4, 4, 4, 4] -> false
</pre>
Or, more generally, replacing
<lang ecmascript>for (d in 1..4) {
System.print("Exactly %(d) adjacent %(d)'s:")
for (list in lists) {
var
System.print("%(list) -> %(condition)")
}
System.print()
}</lang>
{{out}}
|