Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 21:48 23 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : If statement syntax

Author Message
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 114
Posted: 12:56am 30 Mar 2020
Copy link to clipboard 
Print this post

Hi Guys
Just a question on correct syntax.
If I have the following 'if' statement

if LTA > Mxt then
Mxt = LTA
else
endif

Can the 'else' be omitted as it does nothing or should it be retained?
If it should remain then why?

Chrisk
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 01:05am 30 Mar 2020
Copy link to clipboard 
Print this post

Hi
Yes the else can be removed.
you could also use
if LTA > Mxt then Mxt = LTA
and omit the endif

Regards
Jman
 
Chrisk

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 114
Posted: 06:33am 31 Mar 2020
Copy link to clipboard 
Print this post

Great
Thanks Jman

Stay healthy

Regards
Chrisk
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024