Programming Syntax Cheat Sheet V 2.2
Programming Syntax Cheat Sheet V 2.2
Programming Syntax Cheat Sheet V 2.2
Version 2.2
STEP NAME
LANGUAGE
C++
#include <iostream>
using namespace std;
int Main() {
}
Java
Javascript
SYNTAX
Python
PHP
C#
Ruby
<script>
</script>
No specific start required
<?php
?>
using System;
namespace *Project_Name*
{
class *Class_Name*
//Just like Java, in C# also all code is enclosed within a class
static void Main() {
{
C++
int var_1;
char var_2;
float var_3 = 1.0;
Java
Javascript
Declaring a
Variable
Python
var_1=2
var_2= "This is a string"
PHP
$var_1 = 2;
$var_2="This is a string";
C#
int myInt = 1;
float myFloat = 1f;
bool myBoolean = true;
bool anotherBoolean;
string myName = "John";
char myChar = 'a';
Ruby
C++
Java
Javascript
Function/Method
Declaration
var var_1=2;
var var_2="This is a string";
function func_01 {
var var_1=2;
var var_2="This is a string";
}
Python
def func_01:
var_1=2
var_2= "This is a string"
PHP
function func_01 {
var_1=2;
var_2= "This is a string";
}
C#
Ruby
def func_01
_var_1=2
_var_2= "This is a string
C++
if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";
Java
if( x < 20 ) {
System.out.print("This is if statement");
} else {
System.out.print("This is else statement");
}
Javascript
If Statement
Python
PHP
C#
Ruby
a=1
if (a > 5)
Console.WriteLine("Hey! I am Trapped");
else
Console.WriteLine("Now I am free");
x=1
if x > 2
puts "x is greater than 2"
else
puts "I can't guess the number"
end
C++
Java
System.out.print("\n");
String [] names = {"James", "Larry", "Tom", "Lacy"};
for( String name : names ) {
System.out.print( name );
System.out.print(",");
}
Javascript
For Loop
Python
PHP
C#
Ruby
C++
cin >> x;
//Takes the value from user and stores in x
Java
Javascript
Python
C#
Ruby
C++
Java
System.out.print( name );
<h1>My First Web Page</h1>
<p>My first paragraph.</p>
Javascript
Write Operation/
Output
Python
PHP
C#
Ruby
C++
Java
Javascript
Python
Arrays
PHP
C#
Ruby
<script>
document.write(5 + 6);
</script>
person = input('Enter your name: ')
print('Hello', person)
echo "Hello world!";
echo "I'm about to learn PHP!";
Console.WriteLine("Hey! I am Trapped");