How to let GhPython choose the latest updated value?

Hi all,

If there are multi-inputs, is it possible to let GhPython to detect and choose the latest inputted value?
Say I have 3 inputs are 12, 8.3 and 4.8, and the last one I type in is the 8.3, I want to let GhPython automatically always choose the last number I type.


Thanks for any suggestion,

Jack

This is (perhaps) not always working, but a decent starting point:

1 Like

Yes, as @MarcusStrube writes, you could save the values of the previous iteration and compare with the new values. Does it help, @Jack_Zeng?

Splendor!!
I have tested it and it works perfectly!!
Could you explain a little bit more what is sticky and what it exactly doing?
Just want to learn a bit more on this…


Choose the Latest Inputed Value.gh (6.1 KB)

Appreciate for the help,

Jack

I am not too good when it comes to explaining… But you can google sth. like “sticky python grasshopper”. It’s been answered several times. Sticky generally is a dictionary in which you can save all kinds of things to save state. And triplet is a tuple.

Most people, btw, use print very often… And enumerate and zip are very nicely explained in Python’s very good documentation.

1 Like

Cool!
Thanks Marcus!!:grin: