$if

Checks An expression and executes code Only if that expression is true

Shortest Syntax

$if[EXPRESSION]
	CODE
$endIf
1
2
3

What is expression?

Read about it here

Example 1 only with $if

Since the username of the executor is Tom it executed the if block

Tom09/25/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$endIf
Custom Command Bot 09/25/2022
Oh, you are Tom!
Example 2 only with $if and $else

Since the username is not Tom it executes the else block

Bob09/25/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$else
You are not Tom!
$endIf
Custom Command Bot 09/25/2022
You are not Tom!
Example 3 $if , $else and $elseif

Since the username is not Tom .It goes to the next if statement ,which is $elseif[$username==Lisa] and it will execute it

Lisa09/25/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$elseif[$username==Lisa]
You are Lisa!
$endelseIf
$else
I don't know you :C
$endIf
Custom Command Bot 09/25/2022
You are Lisa!
Example 4 $if , $else and $elseif

Since the username is not Tom .It goes to the next if statement ,which is $elseif[$username==Lisa] and it will execute it

Info: The second else if will get never executed ,because it will exit the statement after the first true expression

Lisa09/25/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$elseif[$username==Lisa]
1.You are Lisa!
$endelseIf
$elseif[$username==Lisa]
2.You are Lisa!
$endelseIf
$else
I don't know you :C
$endIf
Custom Command Bot 09/25/2022
1.You are Lisa!
Example 5 multiplie condtions in if with && or ||

Expression can accept multiple conditions, use || or && as separators
|| is for OR
&& is for AND

Example:

$username==Mido&&$country==Egypt
1

Condition 1: $username==Mido Condition 2: $country==Egypt But this expression will only be true only if both condition 1 AND (because of &&) condition 2 is true

The Example below will execute since $username==Tom is false but the second expression is true .It wouldn't work with &&

Lisa09/25/2022
!!exec $if[$username==Tom||$username=Lisa]
You are Tom or Lisa
$endIf
Custom Command Bot 09/25/2022
You are Tom or Lisa

The Example will only execute if the username is Lisa and their tag is 9999

Lisa#999909/25/2022
!!exec $if[$username==Lisa&&$discriminator=9999]
You are Lisa with tag 9999
$endIf
Custom Command Bot 09/25/2022
You are Lisa with tag 9999
Function difficulty: Easy
Tags: if condition decimals