Post Reply 
Mod and other function logic MOD(7,2) or 7 MOD 2?
02-28-2019, 08:26 PM
Post: #1
Mod and other function logic MOD(7,2) or 7 MOD 2?
Hello,
Every time I use the Mod function to calculate the reminder of a division between 2 numbers, I always get an error because I code it the wrong way.
I don't know why but I always code like MOD(7,2) instead of 7 Mod 2.

Is there a rule or a reason why few functions need to be coded differently from the usual func(var1, var2)?

Thanks

Giancarlo
Find all posts by this user
Quote this message in a reply
02-28-2019, 08:34 PM
Post: #2
RE: Mod and other function logic MOD(7,2) or 7 MOD 2?
The instructions can be of different types, the most common is the functions and operators, the functions are usually name(a,b), and the operators are usually placed between 2 values ​​such as:
8 + 5
10 / 2
10 MOD 3
TRUE OR FALSE
5 < 8

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
02-28-2019, 08:40 PM
Post: #3
RE: Mod and other function logic MOD(7,2) or 7 MOD 2?
I think you mentioned that you are interested in Python, here you can see a clear example of the usual operators that exist in programming languages. At the moment it has been given a habitual classification like arithmetical, relational, logical, etc.






In HP Prime have simplified all this, so all the instructions have been grouped as "functions" and, for that reason, they are all in the catalog of functions.

Viga C | TD | FB
Visit this user's website Find all posts by this user
Quote this message in a reply
03-02-2019, 08:46 AM
Post: #4
RE: Mod and other function logic MOD(7,2) or 7 MOD 2?
Thanks Carlos,
Your explanation makes sense to me. As you can understand programming is not my first nature so sometimes I miss some basic rules.

I ignored that MOD was an operator and this is the reason of my mistake in using it.
I will ‘restudy’ the operators just to very the others.

Thanks also for the python video. If the video has good contents I will watch the other ones also.

Have a good day,

Giancarlo
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)