that's, you want to say my code won't work the way i want? If "if" expression 
can't return "nothing" when the condition is false, then my code won't work 
correctly, because even it will return, for example, Cell(x:j,y:i), then 
return.sample can select it and delete current (unwanted) cell.

I just wanted to shorten this code
    
    
     Directions = newSeq[Cell]()
            if i-1 > 0 and i-1 < Size:
                Directions.add(Cell(x:j, y:i-1))
            if j+1 > 0 and j+1 < Size:
                Directions.add(Cell(x:j+1, y:i))
            if not (j+1 > 0 and j+1 < Size) and not (i-1 > 0 and i-1 < Size):
                Directions.add(Cell(x:j,y:i))
            var Direction = random.sample(Directions)
    
    Run

Reply via email to