bitburner-src/markdown/bitburner.ns.getpurchasedservercost.md

42 lines
920 B
Markdown
Raw Normal View History

2021-10-30 18:34:14 +02:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [getPurchasedServerCost](./bitburner.ns.getpurchasedservercost.md)
## NS.getPurchasedServerCost() method
Get cost of purchasing a server.
2021-10-30 18:34:14 +02:00
<b>Signature:</b>
```typescript
getPurchasedServerCost(ram: number): number;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| ram | number | Amount of RAM of a potential purchased server. Must be a power of 2 (2, 4, 8, 16, etc.). Maximum value of 1048576 (2^20). |
<b>Returns:</b>
number
The cost to purchase a server with the specified amount of ram.
## Remarks
2021-10-30 21:46:34 +02:00
RAM cost: 0.25 GB
2021-10-30 18:34:14 +02:00
Returns the cost to purchase a server with the specified amount of ram.
2021-10-30 18:34:14 +02:00
## Example
2021-10-30 21:46:34 +02:00
```ts
2021-10-30 18:34:14 +02:00
for (i = 1; i <= 20; i++) {
tprint(i + " -- " + getPurchasedServerCost(Math.pow(2, i)));
}
```