Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Conditionals
//Conditionals //"If" //Test 1 //use two equal signs "==" for comparing if(1 == 1){ print('This is true'); } //Test 2 var var1 = 3 var var2 = 4 //nothing will show up for this test because it is not true if(var1 == var2){ print('yes'); } //for testing is two variables are not equal, use "!=" if( var1 != var2){ print('these do not equal') } //Test 3- using "else" var var3 = 3 var var4 = 5 if(var3 == var4){ print('yep'); } else { print('nope'); } // you can put more than one conditional (use "&&") var var5 = 3 var var6 = 7 if(var5 != var6 && var5 == 3){ print('correct') } else { print('incorrect'); } // incorect example: if(var5 != var6 && var5 == 4){ print('yeah') } else { print('nah') } //Switch statemants var fruit = 'apple'; switch(fruit){ case "banana": print('I hate bananas'); break; case "apple": print('I love apples'); break; case "orange": print('Oranges are okay'); break; default: print('I love all other fruits'); break; } // If you change the variable "fruit" to bananas or oranges it will print their lines insteasd of apple's. //if you set the variable "fruit" to anything else, it will print the default.
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Time it has been since Tuesday, January 1st, 2019
my dick!!!
js object to json string
Alternating Sign Fibonacci
Dum
test
sortStack
zeroMatrix
game green
Try
Please log in to post a comment.