Sure there is, read the manual it is all covered there
https://www.amibroker.com/guide/keyword/if.html - explains how to use if()
including working with arrays
and
http://www.amibroker.com/guide/a_mistakes.html
(BTW: use code tags as per "how to use this site")