Search a list: Difference between revisions

add BQN
(Add CLU)
(add BQN)
Line 502:
ERROR 100, "Not found"
ENDIF</lang>
 
=={{header|BQN}}==
 
Generally, <code>⊐</code>(Index Of) is used to findex the indices of the right argument array's elements in the left argument. It returns the length of the left argument <code>𝕨</code> if the argument is not present.
 
The given <code>IndexOf</code> function is written to satisfy question requirements(throwing exceptions), and it is not recommended for use in production.
 
<lang bqn>list ← ⟨"Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty", "Charlie", "Bush", "Boz", "Zag"⟩
 
IndexOf ← {
("Error: '" ∾𝕩∾ "' Not found in list") ! (≠𝕨)≠ind ← ⊑𝕨⊐⋈𝕩
ind
}
 
•Show list ⊐ "Wally"‿"Hi" # intended
•Show list IndexOf "Wally"
list IndexOf "Hi"</lang><lang>⟨ 2 10 ⟩
2
! "Error: 'Hi' Not found in list"
 
("Error: '" ∾𝕩∾ "' Not found in list") ! (≠𝕨)≠ind ← ⊑𝕨⊐⋈𝕩
^
 
list IndexOf "Hi"
^^^^^^^</lang>
 
=={{header|Bracmat}}==
236

edits