# Confusion on nil and null in test cases

**URL:** <https://forum.codecrafters.io/t/confusion-on-nil-and-null-in-test-cases/4711>\
**Category:** Challenges\
**Tags:** challenge:interpreter\
**Created:** [February 7, 2025, 9:13am UTC](https://forum.codecrafters.io/t/confusion-on-nil-and-null-in-test-cases/4711 "2025-02-07T09:13:33Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [February 7, 2025, 7:11pm UTC](https://forum.codecrafters.io/t/confusion-on-nil-and-null-in-test-cases/4711/3 "2025-02-07T19:11:06Z")

</div>

Hi @Dyr-El, you’re right that the Lox language and its Java implementation aren’t entirely consistent.

To clarify, `null` is not part of Lox itself, but a Java primitive that the author used in his implementation.

For context, here are the author’s [test cases](https://github.com/munificent/craftinginterpreters/blob/01e6f5b8f3e5dfa65674c2f9cf4700d73ab41cf8/test/scanning/keywords.lox) for tokens with `null` in the literal field.

He had to use `null` (Java) instead of `nil` (Lox) in the Java tests, and we’re stuck with `null` even if we use other languages.

* * *

A heads-up: you will encounter [another inconsistency](https://forum.codecrafters.io/t/inconsistent-expectations-of-integers/1282) in the next stage (#lv1 Literals: Strings & Numbers). Be prepared!

---

_[View the full topic](https://forum.codecrafters.io/t/confusion-on-nil-and-null-in-test-cases/4711)._
