Bug that prevents you from using string blocks as an input in the or block
-
I want to use the number and string blocks as inputs for the or and and blocks.

-
@colobro309 That isn't a bug, that's just how mathematics works.
And/or are logical functions, they only take true/false as inputs and returns a true/false.
Add/subtract are arithmetic functions, they only take numbers as inputs and returns a number.You will need to convert your string or number into a true/false value first.
The "IF" block can do this as it returns true/false.
Eg "If number=0 return false else return true" -
In python you can use strings with the or and and keywords. The program sends a TCP request and prints the response, but if it fails it prints connection error.
def Send_TCP_Request(): try: tcpc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcpc.settimeout(1) tcpc.connect(('0.0.0.0', 8000)) tcpc.send('Hello World') Result = tcpc.recv(1024) tcpc.close() except: Result = None return Result def setup(): M5.begin() print(Send_TCP_Request() or "Connection Error")
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login