add method for similar to match julia