Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the "Inline if function" with just 2 arguments #2966

Closed
babakfp opened this issue Dec 1, 2020 · 2 comments
Closed

Use the "Inline if function" with just 2 arguments #2966

babakfp opened this issue Dec 1, 2020 · 2 comments

Comments

@babakfp
Copy link

babakfp commented Dec 1, 2020

#2964 | @mirisuzanne
OMG, why you closed my issues!. You misunderstood what I meant.

$city: "New York";
$city: if($city == "New York", "Los Angeles", "New York"); // be able to write this...
$city: if($city == "New York", "Los Angeles"); // ...like this.
  • Be possible to use the "inline if function" with 2 arguments.
  • If the condition was true, you want to do something, if it's not true, do nothing. I don't want to rewrite the $city with the same value because it's wrong.
// There is a big difference between this:
@if $city == "New York" {
  $city: "Los Angeles";
}
// and this:
$city: if($city == "New York", "Los Angeles", "New York");

Another issue:

This is about one of your pull requests @mirisuzanne. I don't know if anyone sawed this problem or not.
#2836 (comment)

@mirisuzanne
Copy link
Contributor

Yes, I understood. I'm saying you can already:

$city: if($city == "New York", "Los Angeles", "New York"); // write this...
$city: if($city == "New York", "Los Angeles", $city); // ...like this.

So the functionality you are requesting is already there. I don't think there is a reasonable way to make that implicit, because it is so contextual - but I can let someone else speak to that.

(yes, I saw the other issue - haven't had a chance to dig into it)

@babakfp
Copy link
Author

babakfp commented Dec 3, 2020

I don't want to use the third argument. So I prefer to use regular if statements rather than using this function to don't write the same value in my variable.

@babakfp babakfp closed this as completed Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants