This article may meet Wikipedia's criteria for speedy deletion as a very short article lacking sufficient context to identify the subject of the article. See CSD A1.
If this article does not meet the criteria for speedy deletion, or you intend to fix it, please remove this notice, but do not remove this notice from pages that you have created yourself. If you created this page and you disagree with the given reason for deletion, you can click the button below and leave a message explaining why you believe it should not be deleted. You can also visit the talk page to check if you have received a response to your message. Note that this article may be deleted at any time if it unquestionably meets the speedy deletion criteria, or if an explanation posted to the talk page is found to be insufficient.
Note to administrators: this article has content on its talk page which should be checked before deletion. Administrators: check links, talk, history (last), and logs before deletion. Consider checking Google.This page was last edited by Caesura (contribs | logs) at 17:27, 1 December 2007 (UTC) (17 years ago) |
Data types
How to declare variable x as the following types:
Integer | Unsigned integer | Float | String | |
---|---|---|---|---|
C | int x; | unsigned int x; | float x; or double x; | char x[]; or char *x; |
C++ (STL) | int x; | unsigned int x; | float x; ordouble x; | string x; |
Java | String x; (???) | |||
Pascal | var x: integer; | var x: real; | var x: string; | |
Visual Basic | dim x as integer | |||
Python | x = value | x = value | x = value | x = "string" |
Logical cycles
if | else if | while | for i = 1 to N | select case | |
---|---|---|---|---|---|
C | if (condition) { instructions } else { instructions } | if (condition) { instructions } else if (condition) { instructions } | while (condition) { instructions } | for (i = 0; i<N; i++) { instructions } | switch (variable) { case case1: instructions break; ... } |
C++ (STL) | as above | as above | as above | as above | as above |
Java | as above | as above | as above | as above | as above |
Pascal | if condition then begin \n instructions \n end; | repeat \n instructions \n until condition; | for i := 1 to N do \n begin \n instructions \n end; | ||
Visual Basic | if condition then \n instructions \n end if | while condition \n instructions \n wend | for i = 1 to N step 1 \n instructions \n next | ||
Python | if condition : \n \t instructions \n else: \n \tinstructions \n | for i in range(1, N): \n \t instructions \n |
Function declaration
basic | value-returning function | |
---|---|---|
C | void foo(parameters) { } | typefoo(parameters) { } |
C++ (STL) | as above | as above |
Java | public or private + as above | public or private +as above |
Pascal | procedure foo(...); | function foo(...):type; |
Visual Basic | ||
Python | def foo(parameters): \n \t instructions \n | add return value at the end. |
Data conversions
string to integer | string to float | integer to string | float to string | |
---|---|---|---|---|
C | integer = atoi(string); | float = atof(string); | sprintf(string, "%i", integer); | sprintf(string, "%f", float); |
C++ | ||||
Java | ||||
Pascal | ||||
Visual Basic | ||||
Python |