Wiki If Structure Example Question

Wiki If Structure Example Question - Сообщения

#1 Опубликовано: 09.11.2021 19:10:54
Fran Lee

Fran Lee

1 сообщений из 44 понравились пользователям.

Группа: User

On the Wiki Page titled If Structure

I have several question relative to this image on the page.

If Statement Examples

Question 1:
Is the equal symbol in the first example...
If a
the equal symbol from the Programming Palette Boolean choices
or
the equl symbol from the Programming Pallet Arithmetic choices
or
the equal key on the keyboard?

Asking because I've had difficulty entering the 5 after the equal symbol

Question 2:
I'm confused by "b=5" in the same line
Are we asking... is a less than b when b is equal to the value 5?
Since we assigned a value to b at the beginning... a:=1 b:=2
well it's confusing me.

How would you write this If statement in Python?
The Python interpreter won't run this...


a = 1
b = 2
if a < b=5:
  print("b is greater"
elif a == b:
  print("a equals b"
else:
  print ("a is greater"


That may help me understand what's going on.

Question 3:
What does the arrow symbol mean in the example?
I looked it up online and there appears to be more than one explanation for using the symbol in math.

Thanks for any help.
#2 Опубликовано: 09.11.2021 20:06:43
Fran Lee

Fran Lee

1 сообщений из 44 понравились пользователям.

Группа: User

Overlord,

My questions 1 and 2 only relate to the first example in the image... this one...

a:=1 b:=2

If a5
else
6

I won't repost the questions again in this reply but take a look keeping in mind I'm only asking relative to the above example.

Question 3 is about the 3rd example, the one on the right in the picture.

Thanks for any help on my 3 questions.
#3 Опубликовано: 09.11.2021 20:47:17
overlord

overlord

552 сообщений из 1332 понравились пользователям.

Группа: Moderator

Sorry, misunderstood. I have deleted the reply.
Wiki is old, very old. (it says 2010 on top of it)
I don't know what those if usages.
I started to use Smath late 2012.

I use Reference Book for getting help.
It has relatively up to date information.

Regards
#4 Опубликовано: 09.11.2021 21:02:32
Fran Lee

Fran Lee

1 сообщений из 44 понравились пользователям.

Группа: User

Just found the reference book under help.
I have SMath Studio Handbook 0.99.6671
Is that the latest? If not how do I update?

Regarding my questions... I think I'm beginning to figure it out
and not sure I articulated the questions properly.

Given:
a:=1 b:=2

and the conditional statement
line 1: If a < b = __
line 2: 5
line 3: else
line 4: 6

If a < b is true then the value in line 2 populates the blank after the b = with 5

If a < b is false then the value in line 4 populates the blank after the b = with 6

That is tricky syntax to me but I think I have it figured out...

Maybe someone will correct me if I am wrong.
#5 Опубликовано: 09.11.2021 21:18:00
overlord

overlord

552 сообщений из 1332 понравились пользователям.

Группа: Moderator

Wrote

Is that the latest? If not how do I update?
Maybe someone will correct me if I am wrong.


It is the latest. You can update when an update released.
All updates are done through Tools>Plugins.
There is Local storage button on top-right.
If you click on it you can select Online gallery.
You can install plugins from here and/or update installed.

You are right. Nothing to correct about.
Inline result showing may confused you at first.
If you look this way, it will be more clearer.

Regards

2021-11-10_03-17.png
#6 Опубликовано: 09.11.2021 22:41:41
Fran Lee

Fran Lee

1 сообщений из 44 понравились пользователям.

Группа: User

Thanks Overlord!
And, you are right, the solution you showed is very clear... and inline solutions are Confusing... at least to me right now... but, I'm learning...thanks to you guys assistance.
This is an amazing program!
1 пользователям понравился этот пост
overlord 09.11.2021 22:42:00
#7 Опубликовано: 10.11.2021 10:33:54
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I have several question relative to this image on the page.


Generalize algo style for infinite demands.

if_otherwise.PNG
#8 Опубликовано: 10.11.2021 11:12:41
NDTM Amarasekera

NDTM Amarasekera

130 сообщений из 352 понравились пользователям.

Группа: User

This way also, using lele function. Thank you Jean for the example.

Cheers

IF_Ex.png
lele.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений