Tutorial by Examples: el

You can use custom delimiters (regular expressions) with Scanner, with .useDelimiter(","), to determine how the input is read. This works similarly to String.split(...). For example, you can use Scanner to read from a list of comma separated values in a String: Scanner scanner = null; tr...
This program will output "Hello World!" #import <Foundation/Foundation.h> int main(int argc, char * argv[]) { NSLog(@"Hello World!"); } #import is a pre-processor directive, which indicates we want to import or include the information from that file into the pr...
The most widely used language construct to print output in PHP is echo: echo "Hello, World!\n"; Alternatively, you can also use print: print "Hello, World!\n"; Both statements perform the same function, with minor differences: echo has a void return, whereas print retu...
This program prints Hello World! to the standard output stream: #include <iostream> int main() { std::cout << "Hello World!" << std::endl; } See it live on Coliru. Analysis Let's examine each part of this code in detail: #include <iostream> is a...
To create a simple C program which prints "Hello, World" on the screen, use a text editor to create a new file (e.g. hello.c — the file extension must be .c) containing the following source code: hello.c #include <stdio.h> int main(void) { puts("Hello, World")...
When both operands are numeric, they are compared normally: 1 < 2 // true 2 <= 2 // true 3 >= 5 // false true < false // false (implicitly converted to numbers, 1 > 0) When both operands are strings, they are compared lexicographically (according to alphabeti...
Alternatively, you can use the Interactive Ruby Shell (IRB) to immediately execute the Ruby statements you previously wrote in the Ruby file. Start an IRB session by typing: $ irb Then enter the following command: puts "Hello World" This results in the following console output (in...
Place this code in a file named HelloWorld.scala: object Hello { def main(args: Array[String]): Unit = { println("Hello World!") } } Live demo To compile it to bytecode that is executable by the JVM: $ scalac HelloWorld.scala To run it: $ scala Hello When the Scala...
Introduction HTML (Hypertext Markup Language) uses a markup system composed of elements which represent specific content. Markup means that with HTML you declare what is presented to a viewer, not how it is presented. Visual representations are defined by Cascading Style Sheets (CSS) and realized...
In its most simple form, an if condition can be used like this: var i = 0; if (i < 1) { console.log("i is smaller than 1"); } The condition i < 1 is evaluated, and if it evaluates to true the block that follows is executed. If it evaluates to false, the block is skipped....
Consider a database with the following two tables. Employees table: IdFNameLNameDeptId1JamesSmith32JohnJohnson4 Departments table: IdName1Sales2Marketing3Finance4IT Simple select statement * is the wildcard character used to select all available columns in a table. When used as a substitute f...
Place the following code into a file name hello.go: package main import "fmt" func main() { fmt.Println("Hello, 世界") } Playground When Go is installed correctly this program can be compiled and run like this: go run hello.go Output: Hello, 世界 Once you are...
Sometimes you don't want to have your function accessible/stored as a variable. You can create an Immediately Invoked Function Expression (IIFE for short). These are essentially self-executing anonymous functions. They have access to the surrounding scope, but the function itself and any internal va...
The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds. It is also a trivial way to achieve an asynchronous operation. In this example calling the wait function resolves the promise after the time specified as first argument: function wait(ms) ...
Tk is the standard graphical user interface (GUI) for Ruby. It provides a cross-platform GUI for Ruby programs. Example code: require "tk" TkRoot.new{ title "Hello World!" } Tk.mainloop The result: Step by Step explanation: require "tk" Load the tk package...
Open a new blank document in the MATLAB Editor (in recent versions of MATLAB, do this by selecting the Home tab of the toolstrip, and clicking on New Script). The default keyboard shortcut to create a new script is Ctrl-n. Alternatively, typing edit myscriptname.m will open the file myscriptname.m ...
git log --oneline will show all of your commits with only the first part of the hash and the commit message. Each commit will be in a single line, as the oneline flag suggests. The oneline option prints each commit on a single line, which is useful if you’re looking at a lot of commits. - sou...
Changing the text of an existing UILabel can be done by accessing and modifying the text property of the UILabel. This can be done directly using String literals or indirectly using variables. Setting the text with String literals Swift label.text = "the new text" Objective-C // Do...
A basic "Hello, World!" program in Haskell can be expressed concisely in just one or two lines: main :: IO () main = putStrLn "Hello, World!" The first line is an optional type annotation, indicating that main is a value of type IO (), representing an I/O action which "...
Arrays can be created by enclosing a list of elements in square brackets ([ and ]). Array elements in this notation are separated with commas: array = [1, 2, 3, 4] Arrays can contain any kind of objects in any combination with no restrictions on type: array = [1, 'b', nil, [3, 4]]

Page 3 of 145