True or False?

lcobell

Logan CoBell

Posted on November 5, 2022

True or False?

In one of our class projects we need to be able to show whether or not a users' account is private or not. To do this I chose to use an if/else statement and used the logical operator && (and) to check if the user whose page we are on is private by writing

 if @the_user.private && "false" 
    <dd>true</dd>
else
    <dd>false</dd>
Enter fullscreen mode Exit fullscreen mode

@the_user is an instance variable in this ruby code that returns the user whose page we are currently on, private is one of the columns in our Users table from our database that stores the boolean value that we compare with "false" thus getting the correct return value.

💖 💪 🙅 🚩
lcobell
Logan CoBell

Posted on November 5, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024