Skip to main content

voltage

Function voltage 

Source
pub fn voltage(current: f64, resistance: f64) -> Option<f64>
Expand description

Computes voltage from current and resistance using Ohm’s law.

§Examples

use use_electricity::voltage;

assert_eq!(voltage(2.0, 5.0), Some(10.0));
assert_eq!(voltage(2.0, -5.0), None);