at x++, providing string value inside if statement means "check if any data is avaible inside that string" use of comparison operator is not must. Study job/code given below static void testIfwithString(Args _args) { str varTestStr; ; varTestStr = 'Hello World!'; info('set data inside variable'); if(varTestStr) { //here if(varTestStr) means if data is there inside varTestStr info('Yes! data is there inside string'); } //make string empty now. varTestStr = ''; info('cleared data from variable.'); if(!varTestStr)//note here sign ! which maean NOT/Reverse { info('No more data inside variable'); } //see below how to write above statement in another way if(varTestStr)//no more use of ! { info('Yes! data is there inside string'); } else { info('No more data inside variable. no more use of ! here.'); } //see below how to write above statement in another way if(varTestStr == '')//the way you mentioned in your question { info('No more data inside variable. using comparison operator'); } }
↧