If Else If Statements

If Else If Statements - How to make an Else If statement - Messages

#1 Posted: 12/13/2023 7:30:07 PM
Captain_North

Captain_North

0 likes in 1 posts.

Group: 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 Posted: 12/13/2023 10:22:09 PM
Jean Giraud

Jean Giraud

983 likes in 6,866 posts.

Group: User

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

Martin Kraska

1,280 likes in 2,202 posts.

Group: 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
Martin KraskaPre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#4 Posted: 12/14/2023 5:57:38 AM
Jean Giraud

Jean Giraud

983 likes in 6,866 posts.

Group: User

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

overlord

573 likes in 1,345 posts.

Group: 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 users liked this post
Oscar Campo 12/18/2023 6:16:00 AM
#6 Posted: 9/10/2025 12:04:29 PM
mule

mule

0 likes in 6 posts.

Group: 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

Edited 9/10/2025 12:09:13 PM
#7 Posted: 9/10/2025 7:16:15 PM
Davide Carpi

Davide Carpi

1,434 likes in 2,908 posts.

Group: 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).
Edited 9/10/2025 7:21:04 PM
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • New Posts
  • No New Posts