C
C#6mo ago
EggxFil

✅ just a quick question about if, else, else if

is there an order i must put it in? or like u can put if then else then else if?
11 Replies
Angius
Angius6mo ago
There is an order, yes An if/else-if/else will execute top to bottom
EggxFil
EggxFilOP6mo ago
alr thanks i assume if u do it any other way you will get an error right?
MODiX
MODiX6mo ago
Angius
REPL Result: Failure
int a = 0;
else {
a = 100;
}
if (a == 50) {
a = 9;
}
else if (a == 9) {
a = 2;
}
int a = 0;
else {
a = 100;
}
if (a == 50) {
a = 9;
}
else if (a == 9) {
a = 2;
}
Exception: CompilationErrorException
- 'else' cannot start a statement.
- Syntax error, '(' expected
- Invalid expression term 'else'
- ) expected
- Invalid expression term 'else'
- ; expected
- 'else' cannot start a statement.
- Syntax error, '(' expected
- Invalid expression term 'else'
- ) expected
- Invalid expression term 'else'
- ; expected
Compile: 208.531ms | Execution: 0.000ms | React with ❌ to remove this embed.
Angius
Angius6mo ago
Yes
EggxFil
EggxFilOP6mo ago
ok thanks last question what is that bot?
Angius
Angius6mo ago
It's MODiX, a bot that runs a lot of stuff on this server Including the $repl service
MODiX
MODiX6mo ago
(Did you mean !eval?) MODiX REPL (server): https://github.com/discord-csharp/CSharpRepl Command line interface REPL: https://github.com/waf/CSharpRepl https://media.discordapp.net/attachments/569261465463160900/1151055959444160582/image.png 1: install the tool globally 2: Open WT settings + add the profile to the WT profile list 3: open the profile via drop down 4: it's an example of that profile open as a tab 5: learn to use C# in it
Angius
Angius6mo ago
uh $eval
MODiX
MODiX6mo ago
Compile C# code in #bot-spam, use !eval Example:
!eval for(int i = 0; i < 4; i++) Console.WriteLine(i);
!eval for(int i = 0; i < 4; i++) Console.WriteLine(i);
Angius
Angius6mo ago
Yeah, this one
EggxFil
EggxFilOP6mo ago
wow thats useful alr thank you i appreciate it
Want results from more Discord servers?
Add your server