Free Download

Installation Instructions



Ask A Question



Lesson 1















Automated Internet

Automated Editors

Sample Scripts

Precompiled Functions

System Features

  Help Page - makeint

( Some help pages may not display correctly in html because those help pages may have sample code
in them, part of which may be mis-interpreted as html tags.

All help pages, including this help page, are available in biterScripting with the help command. )

Function makeint Purpose Makes an int value from other types of values. Return Type int Syntax makeint(<type>(<value>)) Arguments <type> Can be real, int, str, bool. <value> A value of type <type>. This can be a constant, variable, function call, expression, inline command or a combination of these, together resulting in a value of type <type>. Return Value A constant of type int. The <value>, whether it is a variable, expression, or anything else, remains unchanged. Stream Input Streams apply to commands and not to functions. Stream Output Streams apply to commands and not to functions. Stream Error Streams apply to commands and not to functions, although any errors will be written here. Description Depending on <type>, makeint() function performs the type conversion as follows. <type> Return Value ------- ------------------------------------------------------------- real A int value containing rounded off real value. If the fraction in real value is 0.5 or higher, the value is rounded to the next higher int. If the fraction in real value is less than 0.5, the value is rounded to int portion of the real value. int The original int value is returned. (A copy of the original int value is made.) str If the str value contains a valid int constant, then that constant is returned. Else, 0 is returned. bool 1 if the bool value is true, 0 otherwise. Restrictions Although any type can be converted to any other type using the makeXXXX() functions, be careful, as it may sometimes produce unintended results. All system functions are declared as global, and can not be redeclared (overloaded). Valid Examples var str s var int itemsOnSale # The number of items on sale. # ... # s is assigned a string value based # on some text in a file or on a web site. set $itemsOnSale = makeint(str($s)) if ($itemsOnSale<>0) echo "There are a total of " $itemsOnSale " items on sale." else echo "The number of items on sale was not available." endif Will produce either the number of items or an indication that the number of items is not available. Invalid Examples var str s # ... # s is assigned a string value based # on some text in a file. # We will assume that s does indeed # contain correct int value. var int i1 var int i2 set $i1 = $s # Automatic conversion. set $i2 = makeint(str($s)) # Correct coversion. $i1 assignment is incorrect, as it will be 1 if the string is non-empty. Else, it will be 0. Thus, the original int value in the string is not extracted. $i2 assignment is correct, as it extracts the original int value from the string. var int i set $i=makeint(str("2.6")) Will assign 0 to i since the str "2.6" does not contain a valid int value. The correct assignment will be set $i=makeint(real(2.6)) or, set $i=makeint(real(makereal(str("2.6")))) See Also constant var makereal makestr makebool conversion systemvar

2008-2013, All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile,, FVA (Forward Variable Assignment) are trademarks of Is it biterScripting-compatible ? is a service mark of Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.