Search a list: Difference between revisions

no edit summary
No edit summary
Line 234:
 
=={{header|Arturo}}==
<lang arturorebol>haystack: #("[Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Bozo")]
 
loop #("[Bush" "Washington")] @('needle){ [
<lang arturo>haystack: #("Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Bozo")
f i: index haystack needle
 
if f>=0 { print fif? +empty? "i => " + needle } {-> panic ~"'" + |needle| + "'is not in haystack" }
loop #("Bush" "Washington") @(needle){
else |-> programprint panic[i needle]
f: index haystack needle
]</lang>
if f>=0 { print f + " => " + needle } { panic "'" + needle + "' not in haystack" }
}
</lang>
 
{{out}}
 
<pre>4 => Bush
✘ Runtime Error @ file: examples/rosetta/SearchAList.art - line: 4
| program panic
| msg: 'Washington' not in haystack</pre>
 
=={{header|AutoHotkey}}==
1,532

edits