Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Ruby constants

For general discussion related FlowStone

Ruby constants

Postby Rocko » Tue Nov 22, 2016 2:11 pm

Hi,

Stupid question, but still... Any hint on how can I use mathematical constants in ruby?

I want o use 'exp' (natural exponent = 2.71...) or Pi (=3.1415...) in Ruby and looking for a short way to type it in.
I was trying E, math.E, etc but couldn't find a way.
Google didn't help much either...

The only solution I found so far is to define a constant at start of Ruby code, example:

@E=Math.exp(1)

But I guess there is a better way ??

Thanks
Rocko
 
Posts: 186
Joined: Tue May 15, 2012 12:42 pm

Re: Ruby constants

Postby KG_is_back » Tue Nov 22, 2016 2:16 pm

Constants of a class can be accessed by :: operator.

Code: Select all
Math::PI
Math::E

KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia


Return to General

Who is online

Users browsing this forum: No registered users and 52 guests