How to know the array value exist or not?

liangycc
liangycc Altair Community Member
edited October 2020 in Community Q&A

Hi,

Thanks to all of you for your valuable time and efforts putting in helping others.

I have a easy array,like:
set line(0) 1

set line(1) 2

set line(3) 4

i can know whether the array line exists(use array exists line),but how can i know the line(2)(expect 0,1,3) is not in the array?

Because if i use the line(2),the program will break down.
Thank you very much!!!

Answers

  • tinh
    tinh Altair Community Member
    edited November 2018

    Hi

    Use array names line 2

    Or info exists line(2)

  • liangycc
    liangycc Altair Community Member
    edited November 2018

    thank you very much!!