×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simple programming question.

Simple programming question.

Simple programming question.

(OP)
I have been looking all over the net and have been unable to accomplish something that would take 10 seconds in any programming language...HELP PLEASE

simply, I need to run multiple commands if a value is true or false.
Exampl

if H < 5

x=2
y=9
gg=567
h.3=h.9

If H > 5
x=42
y=93
gg=23567
h.3=h.7

I have seen the commen if function (Condition,TV,FV)
but have not been able to find a away to accomplish what I need to do without writing a if statement for every line.

I have so many lines that are based on conditions that it will be really really sloppy if I have to write a (if) for each line.

Can in any way I run a block of code using a if statement.

I have been looking all over the web and couldnt find an example/answer.
Thanks

RE: Simple programming question.


z:2,9,567,h.9  (using ALt m)
z2: same idea
z:if(H>5,z1,z2)
x:z[0
y:z[1
gg:z[2
h.3:z[3

is an easy way to only write one 'if'. There is a shorter way, see if you can find it, that needs no 'if' statements at all.





Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.

RE: Simple programming question.

That's probably full of mistakes, for instance the first z should be a z1

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.

RE: Simple programming question.

(OP)
Thanks Greg.  I think this will get me headed in the right direction

RE: Simple programming question.

(OP)
Ugggg, to use a if like this do all the items in the matrix have to be the same units of measure?

Im getting an error that units dont match when I populate the matrix with different forumals.

any ideas?

RE: Simple programming question.

Yes, elements in a matric should have the same units

TTFN



RE: Simple programming question.

Oh well, you'll have to do it another way.

Cheers

Greg Locock

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close