Wiki If Structure Example Question

Wiki If Structure Example Question - Messages

#1 Posted: 11/9/2021 7:10:54 PM
Fran Lee

Fran Lee

1 likes in 44 posts.

Group: 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 Posted: 11/9/2021 8:06:43 PM
Fran Lee

Fran Lee

1 likes in 44 posts.

Group: 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 Posted: 11/9/2021 8:47:17 PM
overlord

overlord

552 likes in 1332 posts.

Group: 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 Posted: 11/9/2021 9:02:32 PM
Fran Lee

Fran Lee

1 likes in 44 posts.

Group: 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 Posted: 11/9/2021 9:18:00 PM
overlord

overlord

552 likes in 1332 posts.

Group: 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 Posted: 11/9/2021 10:41:41 PM
Fran Lee

Fran Lee

1 likes in 44 posts.

Group: 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 users liked this post
overlord 11/9/2021 10:42:00 PM
#7 Posted: 11/10/2021 10:33:54 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

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


Generalize algo style for infinite demands.

if_otherwise.PNG
#8 Posted: 11/10/2021 11:12:41 AM
NDTM Amarasekera

NDTM Amarasekera

130 likes in 352 posts.

Group: 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
  • New Posts New Posts
  • No New Posts No New Posts