# Motoko syntax is very stange

**URL:** <https://forum.dfinity.org/t/motoko-syntax-is-very-stange/1695>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [December 26, 2020, 3:47pm UTC](https://forum.dfinity.org/t/motoko-syntax-is-very-stange/1695 "2020-12-26T15:47:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amr](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@amr](https://forum.dfinity.org/u/amr)\
**Post date:** [December 26, 2020, 3:47pm UTC](https://forum.dfinity.org/t/motoko-syntax-is-very-stange/1695/1 "2020-12-26T15:47:16Z")

</div>

I am new in Motoko language an I am trying to remove a specific item in the array but I didn’t fine a simple method like remove, delete

```auto
delete array[5];

```

can anyone help  
Can I use another language insted of motoko such as javascript,C#…

---

<div class="post-metadata">

**Author:** ![mymikemiller](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mymikemiller/32/694_2.png) [@mymikemiller](https://forum.dfinity.org/u/mymikemiller)\
**Post date:** [December 26, 2020, 7:52pm UTC](https://forum.dfinity.org/t/motoko-syntax-is-very-stange/1695/2 "2020-12-26T19:52:44Z")

</div>

The Motoko base library is pretty barebones right now, but I’m surprised I can’t find anything in the [Array functions](https://sdk.dfinity.org/docs/base-libraries/array) that allows for simple deletion like that, either by index or by value. Seems like a fairly obvious oversight. Maybe someone can chime in with a better way, but you could remove an item by filtering the array into a new one:

```auto
public func remove(array: [Text], value: Text) : [Text] {
    Array.filter(array, func(val: Text) : Bool { value != val });
}

```

Or possibly slicing the array to avoid the item at the desired index, but I’m not sure if array slicing is even possible in Motoko.

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [December 26, 2020, 9:21pm UTC](https://forum.dfinity.org/t/motoko-syntax-is-very-stange/1695/3 "2020-12-26T21:21:25Z")

</div>

Yes, `Array.filter` works, but since array is fixed-length, inserting/deleting an element from an array takes linear time. You can use `Buffer` or `List` from the base library for efficient insertion and deletion.

---

<div class="post-metadata">

**Author:** ![Ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@Ori](https://forum.dfinity.org/u/Ori)\
**Post date:** [December 27, 2020, 11:21am UTC](https://forum.dfinity.org/t/motoko-syntax-is-very-stange/1695/4 "2020-12-27T11:21:48Z")

</div>

^ @ThanasisNta (this is along a similar line to your last DM).
