search

Home  >  Q&A  >  body text

c++ - 条件表达式中的子表达式什么也不做怎么表示?

 <表达式1> ? <表达式2> : <表达式3>

比如说我想让表达式2什么也不干,但语法又要求必须要有内容才行,这时候写什么好?

ringa_leeringa_lee2803 days ago910

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 12:07:25

    It is better to write if to decide whether to execute expression 3. It is impossible for expression 2 to execute the method, and this ternary expression has lost its meaning.

    reply
    0
  • Cancelreply