Tutorial by Examples: c

Today Fortran is mainly used for numerical computation. This very simple example illustrates the basic program structure to solve quadratic equations: program quadratic !a comment !should be present in every separate program unit implicit none real :: a, b, c real :: discriminant...
Swift label.backgroundColor = UIColor.redColor() label.backgroundColor = .redColor() Swift 3 label.backgroundColor = UIColor.red Objective-C label.backgroundColor = [UIColor redColor];
Suppose you have defined the following Person class: public class Person { String name; int age; public Person (int age, String name) { this.age = age; this.name = name; } } If you instantiate a new Person object: Person person = new Person(25, &qu...
#include <stdlib.h> #include <lauxlib.h> #include <lua.h> #include <lualib.h> int main(void) { lua_State *lvm_hnd = lua_open(); luaL_openlibs(lvm_hnd); /* Load a standard Lua function from global table: */ lua_getglobal(lvm_hnd, "print&quot...
There are 4 looping constructs in Rust. All examples below produce the same output. Infinite Loops let mut x = 0; loop { if x > 3 { break; } println!("{}", x); x += 1; } While Loops let mut x = 0; while x <= 3 { println!("{}", x); x += 1; ...
There are many ways you can create a UIColor: Swift Using one of the predefined colors: let redColor = UIColor.redColor() let blueColor: UIColor = .blueColor() // In Swift 3, the "Color()" suffix is removed: let redColor = UIColor.red let blueColor: UIColor = .blue If the c...
5 <input type="color" name="favcolor" value="#ff0000"> In supporting browsers, the input element with a type attribute whose value is color creates a button-like control, with a color equal to the value of color attribute (defaults to black if value is not spe...
The public keyword makes a class (including nested classes), property, method or field available to every consumer: public class Foo() { public string SomeProperty { get; set; } public class Baz { public int Value { get; set; } } } public class Bar() { publ...
File f = new File(path); String content = new Scanner(f).useDelimiter("\\Z").next(); \Z is the EOF (End of File) Symbol. When set as delimiter the Scanner will read the fill until the EOF Flag is reached.
Active patterns are a special type of pattern matching where you can specify named categories that your data may fall into, and then use those categories in match statements. To define an active pattern that classifies numbers as positive, negative or zero: let (|Positive|Negative|Zero|) num = ...
The HTML 4.01 specification provides several different types of doctypes that allow different types of elements to be specified within the document. HTML 4.01 Strict <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> Includes all...
Directives are one of the most powerful features of angularjs. Custom angularjs directives are used to extend functionality of html by creating new html elements or custom attributes to provide certain behavior to an html tag. directive.js // Create the App module if you haven't created it yet va...
To create and run new WPF project in Visual Studio: Click File → New → Project Select template by clicking Templates → Visual C# → Windows → WPF Application and press OK: Open MainWindow.xaml file in Solution Explorer (if you don't see Solution Explorer window, open it by clicking V...
This progam uses VCL, the default UI components library of Delphi, to print "Hello World" into a message box. The VCL wrapps most of the commonly used WinAPI components. This way, they can be used much easier, e.g. without the need to work with Window Handles. To include a dependency (lik...
There is already a function sum(). As a result, if we name a variable with the same name sum = 1+3; and if we try to use the function while the variable still exists in the workspace A = rand(2); sum(A,1) we will get the cryptic error: Subscript indices must either be real positive integer...
Download and install Visual Studio. Visual Studio can be downloaded from VisualStudio.com. The Community edition is suggested, first because it is free, and second because it involves all the general features and can be extended further. Open Visual Studio. Welcome. Go to File → New ...
Consider following DOM Structure <ul class="parentUl"> <li> Level 1 <ul class="childUl"> <li>Level 1-1 <span> Item - 1 </span></li> <li>Level 1-1 <span> Item - 2 </span></li&gt...
for is the only loop statement in go, so a basic loop implementation could look like this: // like if, for doesn't use parens either. // variables declared in for and if are local to their scope. for x := 0; x < 3; x++ { // ++ is a statement. fmt.Println("iteration", x) } //...
Breaking out of the loop and continuing to the next iteration is also supported in Go, like in many other languages: for x := 0; x < 10; x++ { // loop through 0 to 9 if x < 3 { // skips all the numbers before 3 continue } if x > 5 { // breaks out of the loop once x...
SharedPreferences sharedPreferences = ...; sharedPreferences.registerOnSharedPreferenceChangeListener(mOnSharedPreferenceChangeListener); private final SharedPreferences.OnSharedPreferenceChangeListener mOnSharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener(...

Page 73 of 826