Remove spurious newlines from Gopher conversion of sloum's article.
This commit is contained in:
parent
c99c9af8a0
commit
22ab4c2129
|
@ -182,12 +182,9 @@ I do not know much about the Windows command line, so from here on I will be
|
|||
talking about Linux/BSD/OSX. If you enter:
|
||||
|
||||
cd ~
|
||||
|
||||
mkdir programming_practice
|
||||
|
||||
cd programming_practice
|
||||
|
||||
|
||||
You will move directories to your home directory. The program `cd` takes a file
|
||||
path as an argument. In this case the `~` is something the shell (the actual
|
||||
program running inside the terminal that lets you input commands) knows to
|
||||
|
@ -198,7 +195,6 @@ You can always go directly to this folder with:
|
|||
|
||||
cd ~/programming_practice
|
||||
|
||||
|
||||
Then you can run `ls` to see any files or subfolders you may want to work on/in.
|
||||
|
||||
You now have a place to work on programs. You can navigate to this folder in a
|
||||
|
@ -260,21 +256,15 @@ Create a file named `hello.py` in the current directory (`nano hello.py`, for
|
|||
example) and enter the following text:
|
||||
|
||||
def say_hello():
|
||||
|
||||
name = input("What is your name? ")
|
||||
|
||||
print("Hello " + name)
|
||||
|
||||
|
||||
|
||||
say_hello()
|
||||
|
||||
|
||||
Then run the following in your terminal/shell:
|
||||
|
||||
python3 ./hello.py
|
||||
|
||||
|
||||
If it doesn't work, make sure you have Python 3 installed (type `python3
|
||||
--version` at the shell and see if you get a Python version number printed. It
|
||||
is possible that the program may be called `python` on your system, in which
|
||||
|
@ -290,27 +280,18 @@ the file is using the `cd` command. Then try running the program again.
|
|||
Create a file named `hello.lua` and enter the following text:
|
||||
|
||||
function say_hello()
|
||||
|
||||
io.write("What is your name? ")
|
||||
|
||||
io.flush()
|
||||
|
||||
local name = io.read()
|
||||
|
||||
print("Hello " .. name)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
say_hello()
|
||||
|
||||
|
||||
Then run the following in your terminal/shell:
|
||||
|
||||
lua ./hello.lua
|
||||
|
||||
|
||||
If it doesn't work, make sure you have Lua installed (type `lua -v` at the
|
||||
shell, if you get a version number printed then you are good to go, if not then
|
||||
you should check your install instructions for Lua).
|
||||
|
@ -331,36 +312,22 @@ text:
|
|||
|
||||
package main
|
||||
|
||||
|
||||
|
||||
import (
|
||||
|
||||
"fmt"
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
func main() {
|
||||
|
||||
var name string
|
||||
|
||||
fmt.Print("What is your name? ")
|
||||
|
||||
fmt.Scanln(&name)
|
||||
|
||||
fmt.Printf("Hello %s", name)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Then run the following in your terminal/shell:
|
||||
|
||||
go build
|
||||
|
||||
./go_hello
|
||||
|
||||
|
||||
You may notice that running the program is a little different here. We call `go
|
||||
build` first. This compiles the program into an executable file. We then run
|
||||
that file by giving the shell the path to the file (`./` just means "inside the
|
||||
|
|
Loading…
Reference in New Issue