Skip to content

Conversation

@pkulikov
Copy link
Contributor

@pkulikov pkulikov commented Nov 19, 2018

Supports dotnet/docs#9125

refValue = 0;

index = 2;
((index < 5) ? ref smallArray[index] : ref largeArray[index - 5]) = 100;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To show that ref in front of the conditional ref expression is not necessary.
Also, I've made the examples non-random, in order to present the output in comments. Examples with ref doesn't run in the interactive mode.

// <SnippetConditionalValue>
double sinc(double x) =>
x != 0.0 ? Math.Sin(x) / x : 1.0;
double sinc(double x) => x != 0.0 ? Math.Sin(x) / x : 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor tweak to show that types might be different (double and int in this case).

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like these changes @pkulikov

I'll :shipit: now.

Thanks again for all your contributions to docs.

@BillWagner BillWagner merged commit 327c164 into dotnet:master Nov 19, 2018
@pkulikov pkulikov deleted the update-conditional-operator-snippets branch November 20, 2018 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants