String error for expression

can anyone tell me what is wrong here?

  1. Expression generated an error for (x, y): Operator > not defined for string and int

This works. I think you need parenthesis and β€˜and’ instead of β€˜&’

1 Like

Hi my friend , as dear Martin explained earlier ,

This file may help :
Expression-question.gh (3.1 KB)

Cheers !

P.S. Also you can consider using python in these cases :

a = []
for i in range(len(x)):
    if (x[i] > 200) & (y[i] > 2000):
        value = 0
    elif (x[i] > 150) & (x[i] <= 200) & (y[i] > 1200) & (y[i] <= 2000):
        value = 1
    elif (x[i] < 150) & (y[i] < 1000):
        value = 2
    else:
        value = -1
    a.append(value) 

many thanks of both you @Ali_Najmaei @martinsiegrist

2 Likes