Expressions!!?!

Post your questions and help other users.

Moderator: Martin

Post Reply
Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Expressions!!?!

Post by Lucy » 16 Dec 2019 00:27

Im not too sure of what exactly i can do with expressions... i only know basic stuff. Can i use expression in such a way as this to produce boolean to true/false or do i need to do it differently?
Screenshot_20191216-112536.jpg
Screenshot_20191216-112536.jpg (234.22 KiB) Viewed 11517 times

Micky Micky
Posts: 179
Joined: 16 Oct 2019 17:38

Re: Expressions!!?!

Post by Micky Micky » 16 Dec 2019 10:38

Yes, but I think you have that the wrong way round.
Crude but it works.

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Expressions!!?!

Post by Lucy » 16 Dec 2019 11:10

Haha lol yup i think i do too... thanks darlin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Expressions!!?!

Post by Desmanto » 16 Dec 2019 17:49

You can put anything above the expression. I sometimes have tons of script in the expression and the last line will ends with a simple boolean check. As long as the last line return boolean check. Or the expression can end anywhere that has return true/false, that it is fine. You can even put something like

Code: Select all

value
if value contains boolean true/false. Or even stranger thing like

Code: Select all

sleep(1000)
because sleep() will always be evaluated to true!
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Expressions!!?!

Post by Lucy » 17 Dec 2019 04:25

Haha really... sleep > true... lol thats so obvious and easy... i shoulda thought of 5hat🤪😂
I tried a simple "if (value = my_value); return true;" but it errored and said cannot convert null to boolean!? I think that was roughly what i originally had in expression

Horschte
Posts: 56
Joined: 03 Nov 2014 18:00

Re: Expressions!!?!

Post by Horschte » 17 Dec 2019 21:54

That should work:

Code: Select all

if (value == my_value){
  return true;
}
Or simply:

Code: Select all

value == my_value

Post Reply