Parentheses in code to make code more readable
6 次查看(过去 30 天)
显示 更早的评论
Hi,
i need to write a function and i'm using a few if-else or switch-case and the code starts to be difficult to read.
question: how do i bundle if-else or switch-case with Parentheses to make the code more readable?
thank you :-)

0 个评论
采纳的回答
madhan ravi
2020-6-2
编辑:madhan ravi
2020-6-2
You can’t create a paranthesis like that in a code. I suggest you to make those two conditional statements as two separate functions?
更多回答(1 个)
Steven Lord
2020-6-2
You might be interested in enabling code folding for your if/else blocks and/or your switch/case blocks in the Editor/Debugger preferences. This will give you a visual indicator of where each of those blocks begin and end and will enable you to put them "out of sight, out of mind" once you've finished writing them by hiding the body of those constructs.
2 个评论
madhan ravi
2020-6-2
Wow I thought , code folding was only for functions, looks like it’s even available for sections, cool!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Event Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!