---
title: "Discussion on \"The or-equals operator\" | Hashnode"
description: "Discussion on \"The or-equals operator\". This one feels like a simple concept to teach, but an easy one to forget.\nThe or-equals operator ||= allows a value to be assigned to a variable if and only if that variable evaluates to nil or false.\nConsider, for example: \n\nThis can be expressed as..."
url: "https://hashnode.com/posts/the-or-equals-operator/61c0287f02755832385f3529"
---

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

Discussion

# [The or-equals operator](https://sjgorsky.hashnode.dev/the-or-equals-operator?utm_source=hashnode&utm_medium=feed)

This one feels like a simple concept to teach, but an easy one to forget. The or-equals operator ||= allows a value to be assigned to a variable if and only if that variable evaluates to nil or false. Consider, for example: This can be expressed as...

Dec 20, 2021 · 1 min read · sjgorsky.hashnode.dev  
Read the article

-   [#ruby-on-rails](https://hashnode.com/tag/ruby-on-rails)
-   [#ruby](https://hashnode.com/tag/ruby)
-   [#learning](https://hashnode.com/tag/learning)
-   [#codenewbies](https://hashnode.com/tag/codenewbies)

## Written by

[Scott Gorsky](https://hashnode.com/@sjgorsky)

@sjgorsky · Chicago, IL

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

Git just got real.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
