lang • comp

Comp

Result = Comp ( String1 AS String , String2 AS String [ , Mode AS Integer ] ) AS Integer

Compares two strings, and returns:

  • 0 if the two strings are equal.

  • 1 if String1 is strictly greater than String2.

  • -1 if String1 is strictly lower than String2.

The Mode parameter can be any combination defined in the Comparison methods page.

Examples

If Comp(command, "open") = 0 Then open_file
Dim UserName As String

Print "Please Enter Your User Name:";
Input UserName

If Comp(UserName, "Akiti") = 0 Then
  Print "You Can Enter"
Else
  Print "Sorry, You Cannot Enter"
Endif
' This is illustrative example only.
' To actually delete the file you will need to write the proper code.

Dim answer As String

Print "Do you want to delete the file? [y/n]"
Input answer

If Comp(answer, "y", gb.text) = 0 Then

  '...... (code to delete the file)
  '......
  '......

  ' If succesfull we print the following message
  Print "File Deleted"

Else
  Print "File Not Deleted"
Endif

See also