Run Code
|
API
|
Code Wall
|
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
class Node
greeting
2-D Kinematics with accurate air drag
Javascript is weird
Bhbhbh
Javascript Basics
my dick!!!
H
Rocket Science
Aa