<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Bug that prevents you from using string blocks as an input in the or block]]></title><description><![CDATA[<p dir="auto">I want to use the <strong>number</strong> and <strong>string</strong> blocks as inputs for the <strong>or</strong> and <strong>and</strong> blocks.<br />
<img src="/assets/uploads/files/1710990513956-82e084e5-f6d6-49e4-906f-58fb81ec7328-image.png" alt="0_1710990527180_82e084e5-f6d6-49e4-906f-58fb81ec7328-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/topic/6241/bug-that-prevents-you-from-using-string-blocks-as-an-input-in-the-or-block</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 03:45:49 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6241.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Mar 2024 03:18:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bug that prevents you from using string blocks as an input in the or block on Thu, 21 Mar 2024 19:53:11 GMT]]></title><description><![CDATA[<p dir="auto">In python you can use strings with the <strong>or</strong> and <strong>and</strong> keywords. The program sends a TCP request and prints the response, but if it fails it prints connection error.</p>
<pre><code>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")
</code></pre>
]]></description><link>https://community.m5stack.com/post/24514</link><guid isPermaLink="true">https://community.m5stack.com/post/24514</guid><dc:creator><![CDATA[Colobro309]]></dc:creator><pubDate>Thu, 21 Mar 2024 19:53:11 GMT</pubDate></item><item><title><![CDATA[Reply to Bug that prevents you from using string blocks as an input in the or block on Thu, 21 Mar 2024 10:22:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/colobro309" aria-label="Profile: colobro309">@<bdi>colobro309</bdi></a> That isn't a bug, that's just how mathematics works.<br />
And/or are logical functions, they only take true/false as inputs and returns a true/false.<br />
Add/subtract are arithmetic functions, they only take numbers as inputs and returns a number.</p>
<p dir="auto">You will need to convert your string or number into a true/false value first.<br />
The "IF" block can do this as it returns true/false.<br />
Eg "If number=0 return false else return true"</p>
]]></description><link>https://community.m5stack.com/post/24501</link><guid isPermaLink="true">https://community.m5stack.com/post/24501</guid><dc:creator><![CDATA[dissy]]></dc:creator><pubDate>Thu, 21 Mar 2024 10:22:04 GMT</pubDate></item></channel></rss>