# variable / parameter bindings

**URL:** <https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374>\
**Category:** Advanced Help with Snap!\
**Created:** [August 19, 2024, 2:39pm UTC](https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374 "2024-08-19T14:39:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cameron8299](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/cameron8299/32/18799_2.png) [@cameron8299](https://forum.snap.berkeley.edu/u/cameron8299)\
**Post date:** [August 19, 2024, 2:39pm UTC](https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374/1 "2024-08-19T14:39:40Z")

</div>

i have this:

 ![js3 script pic (3)](https://cdn.forum.snap.berkeley.edu/original/3X/d/a/dab0133aed57fba1d1a8847c9de2641ec076a689.png)  
okay and inside function block:  
 ![js3 script pic (4)](https://cdn.forum.snap.berkeley.edu/original/3X/6/1/61b1968d6e9344cebc0b71fd97f4478c03e14618.png)  
okay and ![js3 script pic (6)](https://cdn.forum.snap.berkeley.edu/original/3X/9/2/92d0c1df09f68b675323d9518ee25f7a18a51171.png) is just  
 ![js3 script pic (5)](https://cdn.forum.snap.berkeley.edu/original/3X/c/2/c26a7522bdcb6de485c3e2fc6b8f467a146058c8.png)  
because for some reason ![js3 script pic (7)](https://cdn.forum.snap.berkeley.edu/original/3X/b/d/bd1b33dde86b4d71b202fe578e6e82865e6a4e18.png) isnt available in certain contexts even though its defined globally. but for Function i have:  
 ![js3 script pic (8)](https://cdn.forum.snap.berkeley.edu/original/3X/7/b/7b0aabf3b7a71ad7c9bc39e71ddc5aff0ca57b94.png)  
and i know im not setting up the variable bindings correctly but in trying to get some sort of debugging information i have:  
 ![js3 script pic (12)](https://cdn.forum.snap.berkeley.edu/original/3X/2/f/2f0427c91afce27322c30402ada5414aeea192ae.png)  
with that inside here:  
 ![js3 script pic (10)](https://cdn.forum.snap.berkeley.edu/original/3X/0/d/0dbbeb0dd3554ee8c24bc02c7642682e46087b4f.png)  
because im getting this error:  
 ![js3 script pic (11)](https://cdn.forum.snap.berkeley.edu/original/3X/3/8/387d44996f4a46d03c6ce44de42d0a9197331512.png)  
and running with the debug block i get this fourth time it stops:  
 ![Screen Shot 2024-08-19 at 9.46.06 AM](https://cdn.forum.snap.berkeley.edu/original/3X/f/6/f6747e76f8830e6ac30faa86debe05f885a01412.png)  
which you can see Function is defined all the way up. but regardless, this is where its trying to call displayName. and the call function definition is just:  
 ![js3 script pic (13)](https://cdn.forum.snap.berkeley.edu/original/3X/a/5/a51b03045114efb2cbb7c141dc2fc44c3737e6c3.png)  
but you can see the variable i want (name: boo) in item 4 with the displayName call block. but for some reason, im getting this for parameterNames in item 2:  
 ![Screen Shot 2024-08-19 at 9.52.29 AM](https://cdn.forum.snap.berkeley.edu/original/3X/4/2/42b0b714773c4e4972481299e67c42d1074be607.png)  
and thats inside of the outer function which was successfully built and called and in the middle of executing. but that parameterNames is whats defined in Function. **Call** :  
 ![js3 script pic (14)](https://cdn.forum.snap.berkeley.edu/original/3X/6/e/6eb5f580caaf1675e7edfa7ee24562eb655d13dc.png)  
and jesus does anyone know the correct way to do this/ what im doing wrong cause this is driving me crazy

---

<div class="post-metadata">

**Author:** ![warpedwartwars](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/warpedwartwars/32/36277_2.png) [@warpedwartwars](https://forum.snap.berkeley.edu/u/warpedwartwars)\
**Post date:** [August 19, 2024, 6:12pm UTC](https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374/2 "2024-08-19T18:12:04Z")

</div>

what on earth is this (yes i know it's an implementation of oop but wow)

---

<div class="post-metadata">

**Author:** ![rixthetyrunt](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/rixthetyrunt/32/37204_2.png) [@rixthetyrunt](https://forum.snap.berkeley.edu/u/rixthetyrunt)\
**Post date:** [August 19, 2024, 6:22pm UTC](https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374/3 "2024-08-19T18:22:23Z")

</div>

ikr 😳

---

<div class="post-metadata">

**Author:** ![cameron8299](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/cameron8299/32/18799_2.png) [@cameron8299](https://forum.snap.berkeley.edu/u/cameron8299)\
**Post date:** [August 19, 2024, 6:43pm UTC](https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374/4 "2024-08-19T18:43:29Z")

</div>

its a freaking nightmare. the main issue im having is getting custom c inputs to capture the surronding scope. i tried seperating the problem into a new project but, yeah:

 ![Screen Shot 2024-08-19 at 1.51.55 PM](https://cdn.forum.snap.berkeley.edu/original/3X/5/a/5aa981cb2a2e314c768e07fe17d95546790a4120.png)  
i know snap is bugged because if i have ![untitled script pic (7)](https://cdn.forum.snap.berkeley.edu/original/3X/f/3/f3408b398aec6054bda64c8455009adc31923f7a.png), a global variable, and i have:  
 ![untitled script pic (8)](https://cdn.forum.snap.berkeley.edu/original/3X/9/6/96a12200aaac36cfccb488db0f58b2658fa496df.png)  
which literally attaches ![untitled script pic (9)](https://cdn.forum.snap.berkeley.edu/original/3X/d/c/dc8b95ec314027b2e7fb7aa3649551922041a8d5.png) to the top of the body of the function, so init becomes this:  
 ![Screen Shot 2024-08-19 at 1.58.14 PM](https://cdn.forum.snap.berkeley.edu/original/3X/a/4/a453951a29e45d8647bbb1c1b69094df7909dce3.png)  
i get this error:  
 ![untitled script pic (10)](https://cdn.forum.snap.berkeley.edu/original/3X/e/4/e4e87297c86896b7ef8616030ac951465aab078a.png)

---

<div class="post-metadata">

**Author:** ![warpedwartwars](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/warpedwartwars/32/36277_2.png) [@warpedwartwars](https://forum.snap.berkeley.edu/u/warpedwartwars)\
**Post date:** [August 19, 2024, 6:53pm UTC](https://forum.snap.berkeley.edu/t/variable-parameter-bindings/17374/5 "2024-08-19T18:53:25Z")

</div>

first thing i'd do is try the `let name be foo`... script several times, removing different blocks from it until i got a minimal case. but if i had to guess, the minimal case would probably be just the outer `function` block and the final `init()`
