From Clomosy Docs

No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
keyword Mod
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
keyword Mod
</div>
 
The mod keyword returns the remainder of the division of two numbers. The integer result of the division is ignored.<br>
The mod keyword returns the remainder of the division of two numbers. The integer result of the division is ignored.<br>


'''Syntax:'''<br>
<b>Example</b><br>
remainder := dividingNumber '''Mod''' divisor;
In the example, it will return the remainder of dividing 20 by 12. So as a result you will see the value 8 on the screen.<br>


'''Example:'''<br>
<pre>
In the example, it will return the remainder of dividing 20 by 12. So as a result you will see the value 8 on the screen.<br>
var
  dividingNumber,divisor,remainder : Integer;
{
  dividingNumber = 20;
  divisor = 12;
  remainder = dividingNumber Mod divisor;
  ShowMessage(IntToStr(dividingNumber)+' Mod '+IntToStr(divisor)+' :'+IntToStr(remainder));
 
}
</pre>
 
<b>Output:</b><br>
<div class="alert alert-success" role="alert" data-bs-theme="light">
20 Mod 12 : 8
</div>


'''var'''<br>
<h2> See Also </h2>
  MyForm:TclForm;
* [[System_Library#Math_Functions | Math Functions]]
  dividingNumber,divisor,remainder : Integer;<br>
{{#seo:|title=Mod Overview in Clomosy - Clomosy Docs}}
'''begin'''<br>
{{#seo:|description=Explore the Mod operator in Clomosy. Simplify arithmetic tasks with efficient remainder operations to enhance your app’s functionality.}}
  MyForm := TclForm.Create(Self);<br>
  dividingNumber := 20;
  divisor := 12;
  remainder := dividingNumber '''Mod''' divisor;
  ShowMessage(IntToStr(dividingNumber)+' Mod '+IntToStr(divisor)+' :'+IntToStr(remainder));<br>
  MyForm.Run;<br>
'''end;'''

Latest revision as of 13:01, 24 December 2024

The mod keyword returns the remainder of the division of two numbers. The integer result of the division is ignored.

Example
In the example, it will return the remainder of dividing 20 by 12. So as a result you will see the value 8 on the screen.

var
  dividingNumber,divisor,remainder : Integer;
 
{
  dividingNumber = 20;
  divisor = 12;
  remainder = dividingNumber Mod divisor;
  ShowMessage(IntToStr(dividingNumber)+' Mod '+IntToStr(divisor)+' :'+IntToStr(remainder));

}

Output:

See Also