Print variable types: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 33: Line 33:
R: [https://stat.ethz.ch/R-manual/R-devel/library/base/html/typeof.html typeof()]
R: [https://stat.ethz.ch/R-manual/R-devel/library/base/html/typeof.html typeof()]


== references ==
== References ==
<references/>
<references/>
== Related articles ==
* [https://en.wikipedia.org/wiki/Code_refactoring Code refactoring - Wikipedia]


{{Template:Troubleshooting}}
{{Template:Troubleshooting}}


[[Category:Programming]]
[[Category:Programming]]

Revision as of 15:26, 1 March 2018

Print type of the variable

PHP gettype()[1]:

# define the variable
$var = 3.14159;

# print type of the variable
echo "type of variable: " . gettype($var);

Python type():[2][3] or print(type(var))

# define the variable
var = 3.14159

# print type of the variable
type(var) # return <class 'type'>
print(type(var))
print("type of variable: " + str(type(var))) # python v. 3 cast type to string

Javascript typeof()[4]

# define the variable
var a = 3.14159;

# print type of the variable
typeof a;
console.log("type of variable:: " + typeof a);

R: typeof()

References

Related articles


Troubleshooting of ...

Template