# Strange error msg

**URL:** <https://forum.crystal-lang.org/t/strange-error-msg/1001>\
**Category:** Crystal Contrib\
**Created:** [July 27, 2019, 2:12pm UTC](https://forum.crystal-lang.org/t/strange-error-msg/1001 "2019-07-27T14:12:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![emrum](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/emrum/32/2749_2.png) [@emrum](https://forum.crystal-lang.org/u/emrum)\
**Post date:** [July 27, 2019, 2:12pm UTC](https://forum.crystal-lang.org/t/strange-error-msg/1001/1 "2019-07-27T14:12:09Z")

</div>

## I got this:

## Syntax error in own\_20.cr:51: expecting token ‘CONST’, not ‘uiButton’ class uiButton \< Object ^

disappeared when I changed char-case to : UiButton  
the Error message is very strange and unrelated though …

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [July 27, 2019, 3:05pm UTC](https://forum.crystal-lang.org/t/strange-error-msg/1001/2 "2019-07-27T15:05:05Z")

</div>

All types/class names begin with a capital letter. The error is saying it was expecting a `CONST` not `uiButton` meaning you should be passing something that starts with a capital letter.

---

<div class="post-metadata">

**Author:** ![emrum](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/emrum/32/2749_2.png) [@emrum](https://forum.crystal-lang.org/u/emrum)\
**Post date:** [July 27, 2019, 9:44pm UTC](https://forum.crystal-lang.org/t/strange-error-msg/1001/3 "2019-07-27T21:44:14Z")

</div>

thanks.

another:  
“Syntax error in myfile.cr:118: can’t define def inside def”  
(this actually was caused by forgetting the “end” of an “if” clause)

**the point is: those messages do not-at-all help to find/solve the issue.**  
so why not just give a quote of shakespear instead ? |irony|

---

<div class="post-metadata">

**Author:** ![phpdude](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/phpdude/32/508_2.png) [@phpdude](https://forum.crystal-lang.org/u/phpdude)\
**Post date:** [July 28, 2019, 12:07am UTC](https://forum.crystal-lang.org/t/strange-error-msg/1001/4 "2019-07-28T00:07:22Z")

</div>

> [@emrum](#):
>
> “Syntax error in myfile.cr:118: can’t define def inside def”  
> (this actually was caused by forgetting the “end” of an “if” clause)

But would Crystal actually know it if it was really the end of a function? You defined a function, put an if block inside it, and `end` means `end` of `if`. Then, you define another function, but your other function wasn’t closed because the `end` just closed the `if`. 😉 (And Crystal doesn’t allow nested functions, unlike Ruby.) In the end, something didn’t get closed.

The compiler stopped when it found its first error, so it didn’t find the other one.

Hope this makes it clearer. 🙂
