---
title: "Discussion on \"Var vs Val in Kotlin\" | Hashnode"
description: "Discussion on \"Var vs Val in Kotlin\". In Kotlin, when we declare a variable and assign it a value, like :\nvar x = 5\nWhat happen behind the scene is, an object is created, having the value ( i.e. 5 ) you assigned to the variable ( i.e. x ). Then the variable hold the reference to the obje..."
url: "https://hashnode.com/posts/var-vs-val-in-kotlin/65a16a0ddba249d67014cecd"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Var vs Val in Kotlin](https://silori.hashnode.dev/var-vs-val-in-kotlin?utm_source=hashnode&utm_medium=feed)

In Kotlin, when we declare a variable and assign it a value, like : var x = 5 What happen behind the scene is, an object is created, having the value ( i.e. 5 ) you assigned to the variable ( i.e. x ). Then the variable hold the reference to the obje...

Jan 12, 2024 · 1 min read · silori.hashnode.dev  
Read the article

-   [#kotlin](https://hashnode.com/tag/kotlin)

## Written by

[Mohit Silori](https://hashnode.com/@mohitsilori)

@mohitsilori

  
[View profile](https://hashnode.com/@mohitsilori)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
