Move.

Post

Share your knowledge.

farshad.
Dec 01, 2024
Expert Q&A

Is there a ternary operator in the Move programming language?

Is there a ternary operator in the Move programming language?

  • Move
  • Move Bug
2
2
Share
Comments
.

Answers

2
Theoremus.
Dec 1 2024, 23:54

There isn't a ternary operator, but the match expression might be a good alternative. An example is provided using the match operator to select based on boolean conditions.

1
Best Answer
Comments
.
Pluto Dev👽.
Dec 2 2024, 05:48

I suggest using an if expression similar to ternary operation, such as let variable = if (something_is_true) 10 else 15;.

1
Comments
.

Do you know the answer?

Please log in and share it.

Move is an executable bytecode language used to implement custom transactions and smart contracts.

148Posts231Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignJune
We use cookies to ensure you get the best experience on our website.
More info