TIP: JS conditional operator

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

TIP: JS conditional operator

Postby david » Mon Dec 08, 2003 7:07 pm

The JS conditional operator shortcut for a single if-else statements works in Servoy:

Code: Select all
if (my_test < 10)
{
   my_string = "it is less than";
}
else
{
   my_string = "it is greater than";
}


Can be rewritten as:

Code: Select all
(my_test < 10)?my_string = "it is less than":my_string = "it is greater than";


- david
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Return to How To

Who is online

Users browsing this forum: No registered users and 7 guests

cron