这里是我现在正在做的一个例子:
以下是一个示例,展示了我的操作:
return
shpc == 0 ? "Currently, based on your selection below, you have not yet identified any hidden cards in your card deck." :
shpc == 1 ? "Currently, based on your selection below, you have one hidden card in your card deck." :
$"Currently, based on your selection below, you have {shpc} hidden cards in your card deck. These will not be visible.";
虽然我知道代码中添加了switch关键字,但是对于这个关键字的具体内容并不是很熟悉。我想知道能否使用switch表达式来实现同样的功能。
switch
语句更加简洁和易于使用。 - Panagiotis Kanavos