Jump to content

Using "else" in an "if" statement.


---
 Share

Recommended Posts

I want to make this code recognize "YES", "Yes" or "yes".

//04.01.25 RS
Run=inquireText("Is the Block Fixture moved out of the way?"+cr()+"You can move the fixture now."+cr()+"User must answer YES to continue."+cr()+"CMM will stop if not YES.")
if Run == "YES"
else 
cncBreak()
endif
//End edit 

I am not structuring something properly and I can't wait to see how simple it is so I can laugh at myself.

Link to comment
Share on other sites

But you can use case conversion if you are trying to convert.

Run = inquireText("Is the Block Fixture moved out of the way?" + cr() + "You can move the fixture now." + cr() + "User must answer YES to continue." + cr() + "CMM will stop if not YES.")

if text(Run).asUppercase == "YES"
  // continue
else
  cncBreak()
endif

 

  • Like! 2
Link to comment
Share on other sites

There are also the following :

 

.asLowercase

and

.asCapitalized

and also :

.startingWithUppercaseLetter

 

Edited
  • Like! 1
  • Awesome! 1
Link to comment
Share on other sites

  • 3 weeks later...

If I may ask - what is the difference in code between:

.asUppercase  ---> all letters are Upper case

.asCapitalized ---> ????? this one I do not understand - Please explain if possible as for me it is same as the one below.

.startingWithUppercaseLetter ---> First letter is Upper case

  • Like! 1
Link to comment
Share on other sites

Capitalized should make first letter from word in upper case.

Example: Hello there fellow comrades -> Hello There Fellow Comrades

  • Like! 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...