+ 2

I'm still confused with this operation '**', '%' and this '//'

Can someone explain it?

10th Feb 2021, 5:01 AM
Christiano
Christiano - avatar
3 odpowiedzi
+ 4
_______________________ ** is for exponent Example: 🔸2 ** 3 Equivalent to: 🔹"2 raise to 3" 🔹2 * 2 * 2 Output: 8 _______________________ % for modulus operator (Remainder) // for floor division (Quotient) Example: 🔸20 / 6 🔹Quotient ---> 3 🔹Remainder ---> 2 In % we get the remainder In // we get the Quotient 20 // 6 == 3 "There are 3 six that can fit in 20" 20 % 6 == 2 "2 is the remainder" _______________________ Other method for getting the //. # Get first the real result 🔹20 / 6 ---> 3.33 # Then remove the decimal (of 3.333) Output: 3
10th Feb 2021, 5:05 AM
noteve
noteve - avatar
+ 3
Thanks for explaination
10th Feb 2021, 5:07 AM
Christiano
Christiano - avatar
+ 1
** raise to or to the power of In math 4². In code 4**2. Exponents // Floor division divide and remove the decimal. Just the whole number you cant say its rounding cause if you round 4.7 itll be 5 if you floor divide it itll be 4 // returns lower whole number % is basically the remainder 9%2 is 1 cause 9/2 is 4 and 1 remains you cant divide it cause itll be decimal
10th Feb 2021, 1:11 PM
Ireneo language