Thread: Bool detection
View Single Post
  #14  
Old 12-14-2007, 06:14 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Float, integer and boolean values are all floating point numbers in Graal script.

This is made for keeping the scripting simple, since you don't need to convert values all the time. You can just do "myvar = 1.5; myvar++;" and the result will be 2.5, while in some languages you can only use "++" on integers. You can check "if (myvar)" instead of doing "if (bool(mybar))", you can do "myvar = true + true + true" to get three.

Basicly the operator automatically converts the variable into the right type if necessary: @ is converting to string, "+" is converting to a number, "&&" is convert to boolean values, "&" is converting to integer (since bit operations only work fine on integer).
Reply With Quote