Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8142945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:57:49+00:00 2026-06-06T12:57:49+00:00

Why else doesn’t work? And prints just 8 but doesn’t 10. Where’s mistake? <%

  • 0

Why else doesn’t work? And prints just “8” but doesn’t “10”. Where’s mistake?

<% if controller.controller_name == ('home' || 'products') %>8<% else %>10<% end %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:57:51+00:00Added an answer on June 6, 2026 at 12:57 pm

    || operator returns first operand if it’s not nil or false. Otherwise it returns second operand. So, in your case it’s always returning ‘home’ and never ‘products’.

    You probably meant something like

    <%= controller.controller_name.in?('home', 'products') ? 8 : 10 %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll keep this brief: can anyone tell me why this doesn't work? The else
When I indent if-then-else construct in emacs lisp, the else block doesn't indent properly.
I'm trying to write an IF ELSE statement to enable shipping, If user doesn't
I'd like to hear, if anyone else encounters the same problems, and doesn't use
Is it just me or does anyone else find it annoying in Visual Studio
Is everybody thinking that everybody else doesn't release softwares as jar and then releases
I have the following statement and the IF ELSE doesn't seem to be working?
I want to do this in ruby: something() if conditional else something_else() This doesn't
I'm kind of stuck on something... my else statement doesn't seem to be working
I was wondering why www.json.org/anyone else doesn't provide an official JAR package of org.json

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.