検索結果

(前の20件 | ) (20 | 50 | 100 | 250 | 500 件) を表示
  • 整数値と真偽値の間には自動変換がなく、キャストもできません。そのため、比較演算子や論理演算子を使って条件式を書く必要があります。 コード例 package main import ( "fmt" "math" ) func main() { if num := math.NaN(); num < 0.0 { fmt.Println("負")…
    15キロバイト (2,033 語) - 2023年2月28日 (火) 05:37
  • 足し算や割り算などといった数式を用いた形式の四則演算は、他の一般的なプログラミング言語と同様に、Goでも可能です。 コード例 package main import "fmt" func main() { fmt.Println("5 + 3 =", 5+3) fmt.Println("5 - 3 =", 5-3)…
    5キロバイト (661 語) - 2023年2月16日 (木) 12:26
  • ImportPathが指定されます。 構文 ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) ; ImportSpec = [ "." | PackageName ] ImportPath ; ImportPath…
    8キロバイト (919 語) - 2021年9月27日 (月) 22:58
  • 平方根などの数学に関する関数を使用したい場合は、モジュールmathをインポートします。 モジュールmathの関数「sqrt()」を使い平方根を求める import math print(math.sqrt(2)) help(math.sqrt) 実行結果 1.4142135623730951 Help on…
    14キロバイト (1,150 語) - 2022年11月12日 (土) 11:06
  • Goでは、配列を宣言するときは、 配列名 := [...]要素型{ 初期化リスト } で宣言します。 配列の例 package main import "fmt" func main() { x := [...]int{7, 5, 3} fmt.Printf("x ⇒ %#v(%T)\n", x, x)…
    7キロバイト (1,165 語) - 2024年2月7日 (水) 07:35
  • 戻値の型{, 戻値の型} ) { /* 処理内容 */ [return 戻値{, 戻値}] } のような構文です。 関数の例 package main import "fmt" func main() { fmt.Println("in main") subr() } func subr() { fmt.Println("in…
    17キロバイト (2,429 語) - 2023年2月28日 (火) 05:55
  • てみることにします。テキストファイルを新しく作り、hello.dという名前にしたらテキストエディターで以下のように編集します。 hello.d import std.stdio; void main() { writeln("Hello World!"); } さぁ、これを動かしてみましょう。 $ rdmd…
    31キロバイト (4,650 語) - 2023年3月15日 (水) 06:35
  • Python 3.12 import datetime import pytz tz = pytz.timezone("Asia/Tokyo") now = datetime.datetime.now(tz) # With Python 3.12 import datetime import zoneinfo…
    14キロバイト (1,364 語) - 2024年1月20日 (土) 08:10
  • main import "fmt" func main() { fmt.Println("Hello, World") } Goでは、ソースファイルの冒頭に package 文があります。これに続いて import 文があります。 package文: ファイルの冒頭にあります。 import文:…
    34キロバイト (4,895 語) - 2024年1月16日 (火) 07:24
  • 型の値を受け取る変数を指定する必要があります。この変数は、通常、1文字目を小文字にした名前をつけます。 メソッドの例 package main import "fmt" type Number int func (n Number) pow() Number { return n * n } func…
    11キロバイト (1,498 語) - 2023年2月27日 (月) 11:17
  • Goの関数は、再帰的関数呼出し(recursive function call)が可能です。 再帰的関数呼出し package main import ( "fmt" "math/rand" "time" ) func strd(i int) string { if i < 0 { return "-"…
    2キロバイト (261 語) - 2021年10月5日 (火) 02:32
  • OpenCSGで正しくレンダリングするためだけに必要であり、最終的なレンダリング結果には影響をおよぼさない。 例: import("example012.stl", convexity=3); import("D:\\Documents and Settings\\User\\My Documents\\Gear…
    4キロバイト (629 語) - 2015年2月14日 (土) 17:41
  • ExpressionList ] | "=" ExpressionList ) ; Goで変数を使うためには、宣言が必要です。 宣言とゼロ値 package main import "fmt" // main関数は、Goプログラムのエントリーポイントです。 func main() { // 変数nを宣言します。 var n…
    21キロバイト (2,941 語) - 2023年5月19日 (金) 14:30
  • import Dispatch let NMAX = 100 DispatchQueue.global(priority: .low).async { var n = 1.0 var e = 1.0 for i in 1...NMAX { n *= Double(i) e += 1.0 / n print("e(\(i))…
    4キロバイト (465 語) - 2023年8月15日 (火) 09:48
  • 構造体の中では、空白でないフィールド名は一意でなければなりません。 構造体の例 package main import "fmt" func main() { item := struct { Name string Price int }{ Name: "牛乳"…
    10キロバイト (1,285 語) - 2022年6月5日 (日) 01:45
  • 関数名で示される関数は呼び出される goroutine 側のスレッドですが、引数列の評価は生成元の goroutine で行われます。 コード例 package main import ( "fmt" "time" ) func main() { go func() { fmt.Println("goroutine .. start")…
    11キロバイト (1,307 語) - 2021年10月19日 (火) 07:15
  • on}\n{response}\n---") from PIL import Image import numpy as np import requests import torch from transformers import DPTForDepthEstimation, DPTFeatureExtractor…
    12キロバイト (1,504 語) - 2023年9月22日 (金) 13:56
  • Goのメソッドは、メソッドチェイン(method chaining)が可能です。 メソッドチェイン package main import "fmt" type Student struct { name string age int } func (s Student) PrintName() Student…
    1キロバイト (151 語) - 2021年10月23日 (土) 00:14
  • pygameは、Pythonの2Dゲーム開発向けのオープンソースライブラリです。 import pygame # 画面の初期化 pygame.init() screen = pygame.display.set_mode((800, 600)) # 画像の読み込みと表示 image = pygame…
    5キロバイト (552 語) - 2023年7月8日 (土) 11:51
  • 関数の第1戻値は正常動作時の戻値(*os.File)、第2戻値はエラー時に nil 以外を返します。 ファイルのオープンと読出し(バッファリングなし) package main import ( "io" "log" "os" ) func main() { f, err := os.Open("/etc/hosts") if err…
    7キロバイト (908 語) - 2024年3月3日 (日) 11:01
(前の20件 | ) (20 | 50 | 100 | 250 | 500 件) を表示