Assigning Values to an Array: Difference between revisions

→‎{{header|AWK}}: + error raising
(→‎{{header|AWK}}: + error raising)
Line 71:
hello salut
</lang>
The above code does not raise an error if the array element does not exist.
I am not sure how to raise a deliberate error in awk, but 1/0 comes in handy, if really required:
<lang AWK>$ awk 'BEGIN{a["hello"]="salut";if("hellx" in a)a["hellx"]="bonjour";else 1/0;for(i in a)print i,a[i]}'
awk: cmd. line:1: fatal: division by zero attempted</lang>
 
=={{header|Brainf***}}==
Anonymous user