Mod and other function logic MOD(7,2) or 7 MOD 2? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Mod and other function logic MOD(7,2) or 7 MOD 2? (/thread-12522.html) |
Mod and other function logic MOD(7,2) or 7 MOD 2? - Giancarlo - 02-28-2019 08:26 PM 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 RE: Mod and other function logic MOD(7,2) or 7 MOD 2? - Carlos295pz - 02-28-2019 08:34 PM 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 RE: Mod and other function logic MOD(7,2) or 7 MOD 2? - Carlos295pz - 02-28-2019 08:40 PM 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. RE: Mod and other function logic MOD(7,2) or 7 MOD 2? - Giancarlo - 03-02-2019 08:46 AM 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 |