# Help with basic function

**URL:** <https://forum.dynamobim.com/t/help-with-basic-function/20976>\
**Category:** Lists-Logic\
**Tags:** function\
**Created:** [April 12, 2018, 10:00am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976 "2018-04-12T10:00:09Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert.ek](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@robert.ek](https://forum.dynamobim.com/u/robert.ek)\
**Post date:** [April 12, 2018, 10:00am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/1 "2018-04-12T10:00:09Z")

</div>

HI,  
Why is list.last item not working inside a function?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/6/769e7720a3e7d6d4bb5e6ad48f9fd46d98d0f313.png)

---

<div class="post-metadata">

**Author:** ![mrathnakar](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mrathnakar/32/83799_2.png) [@mrathnakar](https://forum.dynamobim.com/u/mrathnakar)\
**Post date:** [April 12, 2018, 10:02am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/2 "2018-04-12T10:02:41Z")

</div>

Yep you got the last item!

Whats wrong there?

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [April 12, 2018, 10:04am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/3 "2018-04-12T10:04:17Z")

</div>

Think the issue is with the definition made in codeblock called “name” is not returning the same as the ootb node.

---

<div class="post-metadata">

**Author:** ![robert.ek](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@robert.ek](https://forum.dynamobim.com/u/robert.ek)\
**Post date:** [April 12, 2018, 10:04am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/4 "2018-04-12T10:04:25Z")

</div>

in my head the function “name” should give that last item?

---

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [April 12, 2018, 10:17am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/5 "2018-04-12T10:17:30Z")

</div>

**Point.ByCoordinates** Output and **name(x)** Output both are same.

Point name is not define in Revit.

---

<div class="post-metadata">

**Author:** ![Fiesta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/fiesta/32/31914_2.png) [@Fiesta](https://forum.dynamobim.com/u/Fiesta)\
**Post date:** [April 12, 2018, 10:22am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/6 "2018-04-12T10:22:26Z")

</div>

have the same result…and because of that i use python often…its easyer

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/6/26909265664f21fe79a6ef84c7ff87950899083f.png)

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [April 12, 2018, 10:27am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/7 "2018-04-12T10:27:50Z")

</div>

you need to define the structure of your x variable

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/1/719b2c5b1bfd01bc55abe857315542d9d8a080fb.png)

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [April 12, 2018, 10:45am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/8 "2018-04-12T10:45:45Z")

</div>

This is a good post by @colin.mccrone

[http://dynamobim.org/what-does-var-mean/](http://dynamobim.org/what-does-var-mean/)

---

<div class="post-metadata">

**Author:** ![gertjan.vdb](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gertjan.vdb](https://forum.dynamobim.com/u/gertjan.vdb)\
**Post date:** [April 12, 2018, 11:06am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/9 "2018-04-12T11:06:38Z")

</div>

To expand on what salvatoredragotta30m said.  
(Though I’m kinda guessing )

Your function is doing nothing wrong, it’s giving you the last item of the item you entered.  
But you’re passing in a LIST of points. I suppose the code block automatically starts lacing your function over every individual item.  
So it’s not getting your list’s last item. It’s asking every point for its “last item”.

And because you’re asking the “last item” of a single point every time, you’ll ofcourse be getting that exact same point back.  
Dynamo then puts it in a list and pumps it out.

That’s what the var[] is for. It tells dynamo that you want to handle t1 as a list, and not every single item.

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [April 12, 2018, 11:17pm UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/10 "2018-04-12T23:17:14Z")

</div>

@robert.ek .Please mark the topic as solved

---

<div class="post-metadata">

**Author:** ![robert.ek](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@robert.ek](https://forum.dynamobim.com/u/robert.ek)\
**Post date:** [April 13, 2018, 8:23am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/11 "2018-04-13T08:23:30Z")

</div>

🙂  
Thanks for the help

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [April 13, 2018, 10:06pm UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/12 "2018-04-13T22:06:52Z")

</div>

I think we should pin this blog entry 😉

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [April 15, 2018, 10:00am UTC](https://forum.dynamobim.com/t/help-with-basic-function/20976/13 "2018-04-15T10:00:46Z")

</div>

it should be added to the dynamo primer 😀
