If Else If Statements

If Else If Statements - How to make an Else If statement - 消息

#1 已发布: 2023/12/13 19:30:07
Captain_North

Captain_North

0个赞,共1个帖子。

组: User

Hello dear Smath Users,

I accidentally pressed the keyboard once and created an Else-If statement like this:

Afbeelding5.png

Lately I have been struggling to find this option of an Else If statement on Smath studio.

There seemed to be no information on this topic anywhere.

So I figured it out myself:

--Type "if" and press the TAB key.
--Click in the place above the "Else" portion of the If statement.
--Now press ";" and you should get an If Else-If statement.

Kind Regards!

#2 已发布: 2023/12/13 22:22:09
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

1. if/else from program palette
2. alternately from fx menu
3. if/otherwise from fx menu cases
#3 已发布: 2023/12/14 00:29:25
Martin Kraska

Martin Kraska

1,362个赞,共2,276个帖子。

组: Moderator

You add and remove entries just as within vectors or lists (sys) or command blocks (line). If you don't need command blocks in the entries, then probably the cases() function from the custom functions plugin is more reader-friendly than cascades of if().

Programmierung_011.png
Programmierung_012.png
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#4 已发布: 2023/12/14 05:57:38
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Mathcad has if/else in two styles
like Smath and single line => very convenient compactor.
#5 已发布: 2023/12/14 08:43:51
overlord

overlord

600个赞,共1,381个帖子。

组: Moderator

Wrote

Lately I have been struggling to find this option of an Else If statement on Smath studio.


Original if() didn't have else if just over a year ago.
Only persistent else statement existed with one if.
Nowadays you can even eliminate else.

Regards

2023-12-13_18-03.png
1位用户喜欢此帖子
Oscar Campo 2023/12/18 06:16:00
#6 已发布: 2025/9/10 12:04:29
mule

mule

0个赞,共8个帖子。

组: User

Good evening. Somehow the shortcut keys for this one doesn't work for me. Am I doing it right?

Edit. I figured it out already. Under Tools > Options I can set the "Arguments separator" to semicolon

Wrote

You add and remove entries just as within vectors or lists (sys) or command blocks (line). If you don't need command blocks in the entries, then probably the cases() function from the custom functions plugin is more reader-friendly than cascades of if().

Programmierung_011.png
Programmierung_012.png

已编辑 2025/9/10 12:09:13
#7 已发布: 2025/9/10 19:16:15
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: Moderator

You are not forced to change your settings, though. Just use the argument separator you prefer instead of the one in the screenshot (if your is comma, use comma to add arguments instead of the semicolon).
已编辑 2025/9/10 19:21:04
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • 有新帖
  • 无新帖