-->
Page 1 of 1

Having touble with "and" function in basic

PostPosted: Sun Jan 22, 2017 5:38 pm
by TrevorB
And boolean ‘and’ (ex. If a=10 and b=20 then ..)

I have trouble getting from the examples in the BASIC instructions at google docs to a code statement that runs, is it just me or are the example hard to follow. I would like to and two numbers together an print the result.

Can anyone put the top line into a line of code that runs without errors

Re: Having touble with "and" function in basic

PostPosted: Mon Jan 23, 2017 5:43 am
by TrevorB
Still no luck what I had in mind was decimal 251 and decimal 239 which in binary are 11111011 and 11101111 anded together you get 11101011 which is decimal 235

As there are no decimal to binary functions in ESP Basic I assume you can "and" the decimal numbers. I assume that is this bit of the manual

And boolean ‘and’ (ex. If a=10 and b=20 then ..). but very time I use the syntax it wont run.

all I want is let a =251 let b=239 let c = a and b and get an answer of 235

Re: Having touble with "and" function in basic

PostPosted: Wed Jan 25, 2017 4:47 pm
by quilkin
Just using " a and b" should do what you want. I don't have ESP8266 Basic but it's listed in the Google docs. Did you try that?