if-block_in_switch_case

2 ビュー (過去 30 日間)
Muazma Ali
Muazma Ali 2020 年 4 月 26 日
回答済み: AKARSH KUMAR 2020 年 6 月 24 日
Hi ! I want to know how I can use if blocks within a switch case block I know it is possible but dont know whether I can write an if block right after 'case' line or do I have to write something right after saying 'case':
function aktivitet_samlet= fra_molfraksjon_salt(best_salt_nr_1, best_salt_nr_2, ny_vekt_prosent)
switch best_salt_1
case 'NH4CL'
I mean here can I right an If block directly..?
  1 件のコメント
Stephen23
Stephen23 2020 年 4 月 26 日
"I mean here can I right an If block directly..?"
Yes.

サインインしてコメントする。

回答 (1 件)

AKARSH KUMAR
AKARSH KUMAR 2020 年 6 月 24 日
Yes you can, inside any case you can write if else statements.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by